summaryrefslogtreecommitdiff
path: root/include/linux/fsnotify.h
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 14:07:40 -0400
commit6bff7eccb0d9bdef4123aad5399e73cbc26683a6 (patch)
tree59ebbe6cdc9480008d80670383a6f667f766a3cb /include/linux/fsnotify.h
parent1a5cea7215f7c6bd3c960d7b44e864f3a73d1ad4 (diff)
downloadlwn-6bff7eccb0d9bdef4123aad5399e73cbc26683a6.tar.gz
lwn-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 'include/linux/fsnotify.h')
-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);
}
/*