]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
fs/notify/fanotify/fanotify_user.c: fix FAN_MARK_FLUSH flag checking
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Wed, 4 Jun 2014 23:05:43 +0000 (16:05 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 4 Jun 2014 23:53:52 +0000 (16:53 -0700)
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 <xypron.glpk@gmx.de>
Acked-by: Michael Kerrisk <mtk.manpages@gmail.com>
Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/notify/fanotify/fanotify_user.c

index f6ac6a2fa91ed994f816f6644a5724be46d9cbb0..9163a6ed67d2695f4a38f9d05a35b5aa4e9ecf94 100644 (file)
@@ -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;