Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1484382

[PATCH] configfs: Return -EFBIG from configfs_write_bin_file.

From Phil Turnbull <phil.turnbull@oracle.com>
Newsgroups linux.kernel
Subject [PATCH] configfs: Return -EFBIG from configfs_write_bin_file.
Date 2016-09-15 18:30 +0200
Message-ID <shHHX-Wc-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 fs/configfs/file.c | 1 +
 1 file changed, 1 insertion(+)

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);
-- 
2.9.0.rc2

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] configfs: Return -EFBIG from configfs_write_bin_file. Phil Turnbull <phil.turnbull@oracle.com> - 2016-09-15 18:30 +0200
  Re: [PATCH] configfs: Return -EFBIG from configfs_write_bin_file. Christoph Hellwig <hch@lst.de> - 2016-09-16 13:00 +0200

csiph-web