linux-stable/fs/notify
Amir Goldstein 0143011ad0 fanotify: refine the validation checks on non-dir inode mask
commit 8698e3bab4 upstream.

Commit ceaf69f8ea ("fanotify: do not allow setting dirent events in
mask of non-dir") added restrictions about setting dirent events in the
mask of a non-dir inode mark, which does not make any sense.

For backward compatibility, these restictions were added only to new
(v5.17+) APIs.

It also does not make any sense to set the flags FAN_EVENT_ON_CHILD or
FAN_ONDIR in the mask of a non-dir inode.  Add these flags to the
dir-only restriction of the new APIs as well.

Move the check of the dir-only flags for new APIs into the helper
fanotify_events_supported(), which is only called for FAN_MARK_ADD,
because there is no need to error on an attempt to remove the dir-only
flags from non-dir inode.

Fixes: ceaf69f8ea ("fanotify: do not allow setting dirent events in mask of non-dir")
Link: https://lore.kernel.org/linux-fsdevel/20220627113224.kr2725conevh53u4@quack3.lan/
Link: https://lore.kernel.org/r/20220627174719.2838175-1-amir73il@gmail.com
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:54:57 +02:00
..
dnotify dnotify: move dnotify sysctl to dnotify.c 2022-01-22 08:33:34 +02:00
fanotify fanotify: refine the validation checks on non-dir inode mask 2022-07-07 17:54:57 +02:00
inotify inotify: show inotify mask flags in proc fdinfo 2022-06-09 10:30:02 +02:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile
fdinfo.c inotify: show inotify mask flags in proc fdinfo 2022-06-09 10:30:02 +02:00
fdinfo.h
fsnotify.c fsnotify: consistent behavior for parent not watching children 2022-06-25 15:29:47 +02:00
fsnotify.h fsnotify: count all objects with attached connectors 2021-08-11 13:50:48 +02:00
group.c fsnotify: clarify object type argument 2021-12-15 14:04:03 +01:00
mark.c fsnotify: fix wrong lockdep annotations 2022-06-09 10:30:02 +02:00
notification.c fsnotify: Pass group argument to free_event 2021-10-27 12:34:18 +02:00