The patch titled Subject: inotify: actually check for invalid bits in sys_inotify_add_watch() has been added to the -mm tree. Its filename is inotify-actually-check-for-invalid-bits-in-sys_inotify_add_watch.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/inotify-actually-check-for-invalid-bits-in-sys_inotify_add_watch.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/inotify-actually-check-for-invalid-bits-in-sys_inotify_add_watch.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> Subject: inotify: actually check for invalid bits in sys_inotify_add_watch() The comment here says that it is checking for invalid bits. But, the mask is *actually* checking to ensure that _any_ valid bit is set, which is quite different. Add the actual check which was intended. Retain the existing check because it actually does something useful: ensure that some inotify bits are being added to the watch. Plus, this is existing behavior which would be nice to preserve. I did a quick sniff test that inotify functions and that my 'inotify-tools' package passes 'make check'. Signed-off-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> Cc: John McCutchan <john@xxxxxxxxxxxxxxxxx> Cc: Robert Love <rlove@xxxxxxxxx> Cc: Eric Paris <eparis@xxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/notify/inotify/inotify_user.c | 3 +++ 1 file changed, 3 insertions(+) diff -puN fs/notify/inotify/inotify_user.c~inotify-actually-check-for-invalid-bits-in-sys_inotify_add_watch fs/notify/inotify/inotify_user.c --- a/fs/notify/inotify/inotify_user.c~inotify-actually-check-for-invalid-bits-in-sys_inotify_add_watch +++ a/fs/notify/inotify/inotify_user.c @@ -707,6 +707,9 @@ SYSCALL_DEFINE3(inotify_add_watch, int, unsigned flags = 0; /* don't allow invalid bits: we don't want flags set */ + if (unlikely(mask & ~ALL_INOTIFY_BITS)) + return -EINVAL; + /* require at least one valid bit set in the mask */ if (unlikely(!(mask & ALL_INOTIFY_BITS))) return -EINVAL; _ Patches currently in -mm which might be from dave.hansen@xxxxxxxxxxxxxxx are inotify-actually-check-for-invalid-bits-in-sys_inotify_add_watch.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html