kernel_samsung_a53x/fs/notify
Amir Goldstein 60cb3eaddd fanotify: refine the validation checks on non-dir inode mask
[ Upstream commit 8698e3bab4dd7968666e84e111d0bfd17c040e77 ]

Commit ceaf69f8eadc ("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: ceaf69f8eadc ("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>
[ cel: adjusted to apply to v5.10.y ]
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:58 +01:00
..
dnotify dnotify: use fsnotify group lock helpers 2024-11-19 12:27:55 +01:00
fanotify fanotify: refine the validation checks on non-dir inode mask 2024-11-19 12:27:58 +01:00
inotify inotify: use fsnotify group lock helpers 2024-11-19 12:27:55 +01:00
fdinfo.c fanotify: create helper fanotify_mark_user_flags() 2024-11-19 12:27:55 +01:00
fdinfo.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fsnotify.c fsnotify: consistent behavior for parent not watching children 2024-11-19 12:27:56 +01:00
fsnotify.h fsnotify: count all objects with attached connectors 2024-11-19 12:27:44 +01:00
group.c fsnotify: create helpers for group mark_mutex lock 2024-11-19 12:27:55 +01:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mark.c fsnotify: allow adding an inode mark without pinning inode 2024-11-19 12:27:55 +01:00
notification.c fsnotify: Pass group argument to free_event 2024-11-19 12:27:46 +01:00