linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Ensure FMODE_NONOTIFY is not set by userspace
@ 2010-10-29 10:02 Lino Sanfilippo
  2010-10-29 13:52 ` Eric Paris
  0 siblings, 1 reply; 4+ messages in thread
From: Lino Sanfilippo @ 2010-10-29 10:02 UTC (permalink / raw)
  To: eparis; +Cc: linux-kernel, linux-fsdevel


    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>
---
This patch applies against commit 3970d817558a426cc2f53eaa01182eb9452e0cb1
of branch 'origin/for-next' from git.infradead.org/users/eparis/notify.git


diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index ecb43b3..5c185fa 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);
 }
 
 /*

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-29 16:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-29 10:02 Ensure FMODE_NONOTIFY is not set by userspace Lino Sanfilippo
2010-10-29 13:52 ` Eric Paris
2010-10-29 14:27   ` Lino Sanfilippo
2010-10-29 16:10     ` Eric Paris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).