Index: linux-2.4.31-rsbac-v1.2.4/fs/exec.c
===================================================================
--- linux-2.4.31-rsbac-v1.2.4/fs/exec.c	(Revision 383)
+++ linux-2.4.31-rsbac-v1.2.4/fs/exec.c	(Revision 384)
@@ -1017,6 +1017,7 @@
         union rsbac_target_id_t       rsbac_target_id;
         union rsbac_target_id_t       rsbac_new_target_id;
         union rsbac_attribute_value_t rsbac_attribute_value;
+        int rsbac_has_file_ref = 0;
         #endif
 
 	file = open_exec(filename);
@@ -1071,6 +1072,9 @@
             fput(file);
             return -EPERM;
           }
+
+        get_file(file);
+        rsbac_has_file_ref = 1;
         #endif
 
 	retval = prepare_binprm(&bprm);
@@ -1114,6 +1118,9 @@
                 printk(KERN_WARNING
                        "do_execve() [sys_execve]: rsbac_adf_set_attr() returned error\n");
               }
+
+            if (rsbac_has_file_ref)
+              fput(file);
             #endif
 
 		return retval;
@@ -1131,6 +1138,11 @@
 			__free_page(page);
 	}
 
+        #ifdef CONFIG_RSBAC
+        if (rsbac_has_file_ref)
+                fput(file);
+        #endif
+
 	return retval;
 }
 
