linux/fs/notify
Zhao Hongjiang 3c103fee36 inotify: invalid mask should return a error number but not set it
commit 04df32fa10 upstream.

When we run the crackerjack testsuite, the inotify_add_watch test is
stalled.

This is caused by the invalid mask 0 - the task is waiting for the event
but it never comes.  inotify_add_watch() should return -EINVAL as it did
before commit 676a0675cf ("inotify: remove broken mask checks causing
unmount to be EINVAL").  That commit removes the invalid mask check, but
that check is needed.

Check the mask's ALL_INOTIFY_BITS before the inotify_arg_to_mask() call.
If none are set, just return -EINVAL.

Because IN_UNMOUNT is in ALL_INOTIFY_BITS, this change will not trigger
the problem that above commit fixed.

[akpm@linux-foundation.org: fix build]
Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com>
Acked-by: Jim Somerville <Jim.Somerville@windriver.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Jerome Marchand <jmarchan@redhat.com>
Cc: Eric Paris <eparis@parisplace.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-27 11:27:34 -07:00
..
dnotify fanotify: use both marks when possible 2010-07-28 10:18:55 -04:00
fanotify fanotify: fix missing break 2012-11-26 11:37:41 -08:00
inotify inotify: invalid mask should return a error number but not set it 2013-06-27 11:27:34 -07:00
fsnotify.c vfs: move fsnotify junk to struct mount 2012-01-03 22:57:12 -05:00
fsnotify.h fsnotify: remove global fsnotify groups lists 2010-07-28 10:18:54 -04:00
group.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
inode_mark.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
Kconfig fanotify: allow fanotify to be built 2010-10-28 17:22:13 -04:00
Makefile fsnotify: vfsmount marks generic functions 2010-07-28 09:58:57 -04:00
mark.c fsnotify: don't BUG in fsnotify_destroy_mark() 2012-01-14 18:01:42 -08:00
notification.c fs/notify/notification.c: make subsys_initcall function static 2012-03-23 16:58:31 -07:00
vfsmount_mark.c vfs: move fsnotify junk to struct mount 2012-01-03 22:57:12 -05:00