Skip to contentSkip to conversation

configfs: Return -EFBIG from configfs_write_bin_file.

PATCH Applied Phil Turnbull 2 participants 2 messages Sep 15, 2016 – Sep 16, 2016 configfs

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 fs/configfs/file.c | 1 +
 1 file changed, 1 insertion(+)
fs/configfs/file.c +1 -0
index c30cf49b69d2..2c6312db8516 100644
@@ -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);
Signature · 1 line
2.9.0.rc2