| From | Greg Kroah-Hartman <> | Subject | [PATCH 4.7 22/69] configfs: Return -EFBIG from configfs_write_bin_file. | Date | Wed, 28 Sep 2016 11:05:04 +0200 |
| |
4.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phil Turnbull <phil.turnbull@oracle.com>
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>
--- fs/configfs/file.c | 1 + 1 file changed, 1 insertion(+)
--- a/fs/configfs/file.c +++ b/fs/configfs/file.c @@ -333,6 +333,7 @@ configfs_write_bin_file(struct file *fil if (bin_attr->cb_max_size && *ppos + count > bin_attr->cb_max_size) { len = -EFBIG; + goto out; } tbuf = vmalloc(*ppos + count);
|