Skip to content

Commit

Permalink
configfs: Return -EFBIG from configfs_write_bin_file.
Browse files Browse the repository at this point in the history
The check for writing more than cb_max_size bytes does not 'goto out' so
it is a no-op which allows users to vmalloc an arbitrary amount.

Fixes: 03607ac ("configfs: implement binary attributes")
Cc: [email protected]
Signed-off-by: Phil Turnbull <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
  • Loading branch information
Phil Turnbull authored and Christoph Hellwig committed Sep 16, 2016
1 parent 024c7e3 commit 42857cf
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/configfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ configfs_write_bin_file(struct file *file, const char __user *buf,
if (bin_attr->cb_max_size &&
*ppos + count > bin_attr->cb_max_size) {
len = -EFBIG;
goto out;
}

tbuf = vmalloc(*ppos + count);
Expand Down

0 comments on commit 42857cf

Please sign in to comment.