WSL2-Linux-Kernel/fs/notify
Zhao Hongjiang 04df32fa10 inotify: invalid mask should return a error number but not set it
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>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-04-30 17:04:00 -07:00
..
dnotify new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
fanotify new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
inotify inotify: invalid mask should return a error number but not set it 2013-04-30 17:04:00 -07:00
Kconfig fanotify: allow fanotify to be built 2010-10-28 17:22:13 -04:00
Makefile fs, notify: add procfs fdinfo helper 2012-12-17 17:15:28 -08:00
fdinfo.c Merge branch 'for-next' of git://git.infradead.org/users/eparis/notify 2012-12-20 20:11:52 -08:00
fdinfo.h fs, notify: add procfs fdinfo helper 2012-12-17 17:15:28 -08:00
fsnotify.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
fsnotify.h fsnotify: remove global fsnotify groups lists 2010-07-28 10:18:54 -04:00
group.c fsnotify: make fasync generic for both inotify and fanotify 2012-12-11 13:44:36 -05:00
inode_mark.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
mark.c fsnotify: change locking order 2012-12-11 13:44:36 -05:00
notification.c Merge branch 'for-next' of git://git.infradead.org/users/eparis/notify 2012-12-20 20:11:52 -08:00
vfsmount_mark.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00