From: Heinrich Schuchardt Date: Thu, 22 May 2014 00:42:25 +0000 (+1000) Subject: fs/notify/fanotify/fanotify_user.c: fix FAN_MARK_FLUSH flag checking X-Git-Tag: next-20140530~2^2~454 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=75fdfd72e77cfb1266118eced47684282711a884;p=karo-tx-linux.git fs/notify/fanotify/fanotify_user.c: fix FAN_MARK_FLUSH flag checking If fanotify_mark is called with illegal value of arguments flags and marks it usually returns EINVAL. When fanotify_mark is called with FAN_MARK_FLUSH the argument flags is not checked for irrelevant flags like FAN_MARK_IGNORED_MASK. The patch removes this inconsistency. If an irrelevant flag is set error EINVAL is returned. Signed-off-by: Heinrich Schuchardt Acked-by: Michael Kerrisk Acked-by: Jan Kara Signed-off-by: Andrew Morton --- diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index f6ac6a2fa91e..9163a6ed67d2 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c @@ -776,7 +776,10 @@ SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags, case FAN_MARK_REMOVE: if (!mask) return -EINVAL; + break; case FAN_MARK_FLUSH: + if (flags & ~(FAN_MARK_MOUNT | FAN_MARK_FLUSH)) + return -EINVAL; break; default: return -EINVAL;