summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorPhil Turnbull <phil.turnbull@oracle.com>2016-09-15 12:20:12 -0400
committerChristoph Hellwig <hch@lst.de>2016-09-16 12:58:28 +0200
commit42857cf512cb34c2c8cb50f1e766689d979d64e0 (patch)
tree6092425f1347606feb4861f799022a56eb1c3e0c /fs
parent024c7e3756d8a42fc41fe8a9488488b9b09d1dcc (diff)
downloadlinux-stable-42857cf512cb34c2c8cb50f1e766689d979d64e0.tar.gz
linux-stable-42857cf512cb34c2c8cb50f1e766689d979d64e0.tar.bz2
linux-stable-42857cf512cb34c2c8cb50f1e766689d979d64e0.zip
configfs: Return -EFBIG from configfs_write_bin_file.
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: 03607ace807b ("configfs: implement binary attributes") Cc: stable@kernel.org Signed-off-by: Phil Turnbull <phil.turnbull@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/configfs/file.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index c30cf49b69d2..2c6312db8516 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -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);