--- dnotify/fs/dnotify.c.~1~ Tue Nov 28 18:40:01 2000 +++ dnotify/fs/dnotify.c Sun Mar 10 09:58:32 2002 @@ -63,6 +63,8 @@ break; if (odn != NULL) { if (turning_off) { + if (odn->dn_owner != current->files) + goto out_noperm; *prev = odn->dn_next; redo_inode_mask(inode); dn = odn; @@ -70,6 +72,7 @@ } odn->dn_fd = fd; odn->dn_mask |= arg; + odn->dn_owner = current->files; inode->i_dnotify_mask |= arg & ~DN_MULTISHOT; goto out_free; } @@ -82,6 +85,7 @@ dn->dn_mask = arg; dn->dn_fd = fd; dn->dn_filp = filp; + dn->dn_owner = current->files; inode->i_dnotify_mask |= arg & ~DN_MULTISHOT; dn->dn_next = inode->i_dnotify; inode->i_dnotify = dn; @@ -91,6 +95,11 @@ out_free: kmem_cache_free(dn_cache, dn); goto out; +out_noperm: + write_unlock(&dn_lock); + if (dn) + kmem_cache_free(dn_cache, dn); + return -EPERM; } void __inode_dir_notify(struct inode *inode, unsigned long event) --- dnotify/include/linux/dnotify.h.~1~ Mon Feb 25 22:05:09 2002 +++ dnotify/include/linux/dnotify.h Sun Mar 10 09:52:04 2002 @@ -11,6 +11,7 @@ see linux/fcntl.h */ int dn_fd; struct file * dn_filp; + fl_owner_t dn_owner; }; #define DNOTIFY_MAGIC 0x444E4F54