aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/notify/fanotify/fanotify_user.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index cb7a0c5ff854..0f25fc20a6a7 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -468,26 +468,6 @@ out:
468 return PTR_ERR(fsn_mark); 468 return PTR_ERR(fsn_mark);
469} 469}
470 470
471static int fanotify_update_mark(struct fsnotify_group *group,
472 struct inode *inode, struct vfsmount *mnt,
473 int flags, __u32 mask)
474{
475 pr_debug("%s: group=%p inode=%p mnt=%p flags=%x mask=%x\n",
476 __func__, group, inode, mnt, flags, mask);
477
478 BUG_ON(inode && mnt);
479 BUG_ON(!inode && !mnt);
480
481 if (flags & FAN_MARK_ADD)
482 fanotify_add_mark(group, inode, mnt, flags, mask);
483 else if (flags & FAN_MARK_REMOVE)
484 fanotify_remove_mark(group, inode, mnt, flags, mask);
485 else
486 BUG();
487
488 return 0;
489}
490
491static bool fanotify_mark_validate_input(int flags, 471static bool fanotify_mark_validate_input(int flags,
492 __u32 mask) 472 __u32 mask)
493{ 473{
@@ -583,7 +563,16 @@ SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags,
583 group = filp->private_data; 563 group = filp->private_data;
584 564
585 /* create/update an inode mark */ 565 /* create/update an inode mark */
586 ret = fanotify_update_mark(group, inode, NULL, flags, mask); 566 switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE)) {
567 case FAN_MARK_ADD:
568 ret = fanotify_add_mark(group, inode, NULL, flags, mask);
569 break;
570 case FAN_MARK_REMOVE:
571 ret = fanotify_remove_mark(group, inode, NULL, flags, mask);
572 break;
573 default:
574 ret = -EINVAL;
575 }
587 576
588 path_put(&path); 577 path_put(&path);
589fput_and_out: 578fput_and_out: