summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLino Sanfilippo <LinoSanfilippo@gmx.de>2010-10-29 12:02:17 +0200
committerEric Paris <eparis@redhat.com>2010-10-30 20:07:40 +0200
commit6bff7eccb0d9bdef4123aad5399e73cbc26683a6 (patch)
tree59ebbe6cdc9480008d80670383a6f667f766a3cb /include
parentmake fanotify_read() restartable across signals (diff)
downloadlinux-6bff7eccb0d9bdef4123aad5399e73cbc26683a6.tar.xz
linux-6bff7eccb0d9bdef4123aad5399e73cbc26683a6.zip
Ensure FMODE_NONOTIFY is not set by userspace
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>
Diffstat (limited to '')
-rw-r--r--include/linux/fsnotify.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index ecb43b33d181..5c185fa27089 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -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);
}
/*