From: Phil Turnbull Date: Thu, 15 Sep 2016 16:20:12 +0000 (-0400) Subject: configfs: Return -EFBIG from configfs_write_bin_file. X-Git-Tag: v4.7.6~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71b4a3c04e5b9e69f2b53aac5248a7b34cd57bae;p=thirdparty%2Fkernel%2Fstable.git 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 Signed-off-by: Christoph Hellwig Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/configfs/file.c b/fs/configfs/file.c index bbc1252a59f5f..2ddfa05d71f52 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);