aboutsummaryrefslogtreecommitdiffstats
path: root/fs/notify
diff options
context:
space:
mode:
authorLino Sanfilippo <LinoSanfilippo@gmx.de>2010-11-22 18:46:33 +0100
committerEric Paris <eparis@redhat.com>2010-12-07 16:14:21 -0500
commit1734dee4e3a296cb72b4819fc2e7ef2440737dff (patch)
tree1923b47c601a521ebe5989b1878cd4d1f17d2b20 /fs/notify
parentfa218ab98c31eeacd12b89501e6b99d146ea56cc (diff)
downloadkernel_samsung_smdk4412-1734dee4e3a296cb72b4819fc2e7ef2440737dff.tar.gz
kernel_samsung_smdk4412-1734dee4e3a296cb72b4819fc2e7ef2440737dff.tar.bz2
kernel_samsung_smdk4412-1734dee4e3a296cb72b4819fc2e7ef2440737dff.zip
fanotify: Dont allow a mask of 0 if setting or removing a mark
In mark_remove_from_mask() we destroy marks that have their event mask cleared. Thus we should not allow the creation of those marks in the first place. With this patch we check if the mask given from user is 0 in case of FAN_MARK_ADD. If so we return an error. Same for FAN_MARK_REMOVE since this does not have any effect. Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de> Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs/notify')
-rw-r--r--fs/notify/fanotify/fanotify_user.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index c0ca1fa1550..480434c5ee5 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -769,8 +769,10 @@ SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags,
if (flags & ~FAN_ALL_MARK_FLAGS)
return -EINVAL;
switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_FLUSH)) {
- case FAN_MARK_ADD:
+ case FAN_MARK_ADD: /* fallthrough */
case FAN_MARK_REMOVE:
+ if (!mask)
+ return -EINVAL;
case FAN_MARK_FLUSH:
break;
default: