]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
fuse: check size of FUSE_NOTIFY_INVAL_ENTRY message
authorMiklos Szeredi <mszeredi@suse.cz>
Wed, 24 Aug 2011 08:20:17 +0000 (10:20 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 29 Aug 2011 20:29:15 +0000 (13:29 -0700)
commit c2183d1e9b3f313dd8ba2b1b0197c8d9fb86a7ae upstream.

FUSE_NOTIFY_INVAL_ENTRY didn't check the length of the write so the
message processing could overrun and result in a "kernel BUG at
fs/fuse/dev.c:629!"

Reported-by: Han-Wen Nienhuys <hanwenn@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/fuse/dev.c

index 640fc229df10323b6c9fc94b0bda452157bf1ef0..168a80f7f12b856e795eb916bf79f5e2348e06f6 100644 (file)
@@ -1358,6 +1358,10 @@ static int fuse_notify_inval_entry(struct fuse_conn *fc, unsigned int size,
        if (outarg.namelen > FUSE_NAME_MAX)
                goto err;
 
+       err = -EINVAL;
+       if (size != sizeof(outarg) + outarg.namelen + 1)
+               goto err;
+
        name.name = buf;
        name.len = outarg.namelen;
        err = fuse_copy_one(cs, buf, outarg.namelen + 1);