--- linux-2.4.22-rsbac-v1.2.2/rsbac/data_structures/aci_data_structures.c~	2003-07-01 12:43:06.000000000 +0200
+++ linux-2.4.22-rsbac-v1.2.2/rsbac/data_structures/aci_data_structures.c	2003-10-07 10:36:10.000000000 +0200
@@ -1819,11 +1819,9 @@
     if(!item_p)
       return;
 
-    #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
     /* dput() rsbac_dir_dentry_p, if set */
     if(item_p->rsbac_dir_dentry_p)
       dput(item_p->rsbac_dir_dentry_p);
-    #endif
     /* OK, lets remove the device item itself */
     rsbac_kfree(item_p);
   }; /* end of clear_device_item() */
@@ -2293,7 +2291,7 @@
                                        "rsbac_write_open(): could not unlink %s on dev %02u:%02u, parent check failed!\n",
                                        name, MAJOR(kdev),MINOR(kdev));
                               }
-                            /* unlock parent dir */
+                            /* unlock parent dir (also dput's it) */
                             unlock_dir(old_dir_p);
                             /* free file dentry */
                             dput(file_dentry_p);
@@ -2323,7 +2321,7 @@
                                 err = -RSBAC_EWRITEFAILED;
                                 goto out;
                               }
-                            if (new_file_dentry_p->d_inode)
+                            if (file_dentry_p->d_inode)
                               {
                                 printk(KERN_WARNING
                                        "rsbac_write_open(): relookup of %s returned dentry with existing inode %li\n",
@@ -2380,8 +2378,8 @@
                          name);
 #endif
                 unlock_dir(ldir_dentry_p);
-                dput(file_dentry_p);
                 err = -RSBAC_EWRITEFAILED;
+                goto out_dput;
               }
             /* try to create file in rsbac dir */
             /* if (rsbac_debug_write)
