Skip to content

Commit

Permalink
fuse: check size of FUSE_NOTIFY_INVAL_ENTRY message
Browse files Browse the repository at this point in the history
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>
CC: stable@kernel.org
  • Loading branch information
Miklos Szeredi committed Aug 24, 2011
1 parent 478e084 commit c2183d1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/fuse/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c2183d1

Please sign in to comment.