]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
Ensure FMODE_NONOTIFY is not set by userspace
authorLino Sanfilippo <LinoSanfilippo@gmx.de>
Fri, 29 Oct 2010 10:02:17 +0000 (12:02 +0200)
committerEric Paris <eparis@redhat.com>
Sat, 30 Oct 2010 18:07:40 +0000 (14:07 -0400)
    In fsnotify_open() ensure that FMODE_NONOTIFY is never set by userspace.
    Also always call fsnotify_parent and fsnotify.

Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Signed-off-by: Eric Paris <eparis@redhat.com>
include/linux/fsnotify.h

index ecb43b33d18147a0ffdd32adfc6ccc69241c91ed..5c185fa27089f03b4e9194445ee7bfd842f125c6 100644 (file)
@@ -235,10 +235,11 @@ static inline void fsnotify_open(struct file *file)
        if (S_ISDIR(inode->i_mode))
                mask |= FS_ISDIR;
 
-       if (!(file->f_mode & FMODE_NONOTIFY)) {
-               fsnotify_parent(path, NULL, mask);
-               fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
-       }
+       /* FMODE_NONOTIFY must never be set from user */
+       file->f_mode &= ~FMODE_NONOTIFY;
+
+       fsnotify_parent(path, NULL, mask);
+       fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
 }
 
 /*