Skip to content

Commit 44b350f

Browse files
jeromemarchandeparis
authored andcommitted
inotify: Fix mask checks
The mask checks in inotify_update_existing_watch() and inotify_new_watch() are useless because inotify_arg_to_mask() sets FS_IN_IGNORED and FS_EVENT_ON_CHILD bits anyway. Signed-off-by: Eric Paris <eparis@redhat.com>
1 parent f874e1a commit 44b350f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/notify/inotify/inotify_user.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
566566

567567
/* don't allow invalid bits: we don't want flags set */
568568
mask = inotify_arg_to_mask(arg);
569-
if (unlikely(!mask))
569+
if (unlikely(!(mask & IN_ALL_EVENTS)))
570570
return -EINVAL;
571571

572572
fsn_mark = fsnotify_find_inode_mark(group, inode);
@@ -624,7 +624,7 @@ static int inotify_new_watch(struct fsnotify_group *group,
624624

625625
/* don't allow invalid bits: we don't want flags set */
626626
mask = inotify_arg_to_mask(arg);
627-
if (unlikely(!mask))
627+
if (unlikely(!(mask & IN_ALL_EVENTS)))
628628
return -EINVAL;
629629

630630
tmp_i_mark = kmem_cache_alloc(inotify_inode_mark_cachep, GFP_KERNEL);

0 commit comments

Comments
 (0)