summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Turnbull <phil.turnbull@oracle.com>2016-09-15 12:20:12 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-09-30 10:12:44 +0200
commit71b4a3c04e5b9e69f2b53aac5248a7b34cd57bae (patch)
treeede8ee2e767a9d521af95113a49ad33fffae4a19
parent84bba4be776b894e092bede0797910674da99d58 (diff)
downloadlwn-71b4a3c04e5b9e69f2b53aac5248a7b34cd57bae.tar.gz
lwn-71b4a3c04e5b9e69f2b53aac5248a7b34cd57bae.zip
configfs: Return -EFBIG from configfs_write_bin_file.
commit 42857cf512cb34c2c8cb50f1e766689d979d64e0 upstream. 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") Signed-off-by: Phil Turnbull <phil.turnbull@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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 bbc1252a59f5..2ddfa05d71f5 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);