aboutsummaryrefslogtreecommitdiffstats
path: root/fs/notify/fanotify/fanotify_user.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/notify/fanotify/fanotify_user.c')
-rw-r--r--fs/notify/fanotify/fanotify_user.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 00628d3ce5a2..618867e4d30f 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -430,20 +430,6 @@ static int fanotify_add_inode_mark(struct fsnotify_group *group,
430 return 0; 430 return 0;
431} 431}
432 432
433static bool fanotify_mark_validate_input(int flags,
434 __u32 mask)
435{
436 pr_debug("%s: flags=%x mask=%x\n", __func__, flags, mask);
437
438 /* are flags valid of this operation? */
439 if (!fanotify_mark_flags_valid(flags))
440 return false;
441 /* is the mask valid? */
442 if (!fanotify_mask_valid(mask))
443 return false;
444 return true;
445}
446
447/* fanotify syscalls */ 433/* fanotify syscalls */
448SYSCALL_DEFINE3(fanotify_init, unsigned int, flags, unsigned int, event_f_flags, 434SYSCALL_DEFINE3(fanotify_init, unsigned int, flags, unsigned int, event_f_flags,
449 unsigned int, priority) 435 unsigned int, priority)
@@ -505,7 +491,16 @@ SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags,
505 if (mask & ((__u64)0xffffffff << 32)) 491 if (mask & ((__u64)0xffffffff << 32))
506 return -EINVAL; 492 return -EINVAL;
507 493
508 if (!fanotify_mark_validate_input(flags, mask)) 494 if (flags & ~FAN_ALL_MARK_FLAGS)
495 return -EINVAL;
496 switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE)) {
497 case FAN_MARK_ADD:
498 case FAN_MARK_REMOVE:
499 break;
500 default:
501 return -EINVAL;
502 }
503 if (mask & ~(FAN_ALL_EVENTS | FAN_EVENT_ON_CHILD))
509 return -EINVAL; 504 return -EINVAL;
510 505
511 filp = fget_light(fanotify_fd, &fput_needed); 506 filp = fget_light(fanotify_fd, &fput_needed);