diff options
author | Amir Goldstein <amir73il@gmail.com> | 2020-07-16 10:42:13 +0200 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2020-07-27 21:23:36 +0200 |
commit | 3ef866536645ce1b4f0516e8723d803d0fa6ca26 (patch) | |
tree | bc0ee83c41a2749dd5fc14461049ad2ec659a8c6 /fs | |
parent | fanotify: generalize test for FAN_REPORT_FID (diff) | |
download | linux-3ef866536645ce1b4f0516e8723d803d0fa6ca26.tar.xz linux-3ef866536645ce1b4f0516e8723d803d0fa6ca26.zip |
fanotify: mask out special event flags from ignored mask
The special event flags (FAN_ONDIR, FAN_EVENT_ON_CHILD) never had
any meaning in ignored mask. Mask them out explicitly.
Link: https://lore.kernel.org/r/20200716084230.30611-6-amir73il@gmail.com
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/notify/fanotify/fanotify_user.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index 1e04caf8d6ba..6d30beb320f3 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c @@ -1040,6 +1040,7 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask, __kernel_fsid_t __fsid, *fsid = NULL; u32 valid_mask = FANOTIFY_EVENTS | FANOTIFY_EVENT_FLAGS; unsigned int mark_type = flags & FANOTIFY_MARK_TYPE_BITS; + bool ignored = flags & FAN_MARK_IGNORED_MASK; unsigned int obj_type, fid_mode; int ret; @@ -1087,6 +1088,10 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask, if (mask & ~valid_mask) return -EINVAL; + /* Event flags (ONDIR, ON_CHILD) are meaningless in ignored mask */ + if (ignored) + mask &= ~FANOTIFY_EVENT_FLAGS; + f = fdget(fanotify_fd); if (unlikely(!f.file)) return -EBADF; |