summaryrefslogtreecommitdiff
path: root/fs/configfs
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2016-05-18 16:16:51 +0200
committerChristoph Hellwig <hch@lst.de>2016-06-30 11:28:55 +0200
commitf8608985f851c917b3884b692d8e326b0210d34e (patch)
tree42605ac9096fbe14ddd4582d0933c6af60e76f68 /fs/configfs
parente7bdea7750eb2a64aea4a08fa5c0a31719c8155d (diff)
downloadlinux-rt-f8608985f851c917b3884b692d8e326b0210d34e.tar.gz
configfs: Remove ppos increment in configfs_write_bin_file
The simple_write_to_buffer() already increments the @ppos on success, see fs/libfs.c simple_write_to_buffer() comment: " On success, the number of bytes written is returned and the offset @ppos advanced by this number, or negative value is returned on error. " If the configfs_write_bin_file() is invoked with @count smaller than the total length of the written binary file, it will be invoked multiple times. Since configfs_write_bin_file() increments @ppos on success, after calling simple_write_to_buffer(), the @ppos is incremented twice. Subsequent invocation of configfs_write_bin_file() will result in the next piece of data being written to the offset twice as long as the length of the previous write, thus creating buffer with "holes" in it. The simple testcase using DTO follows: $ mkdir /sys/kernel/config/device-tree/overlays/1 $ dd bs=1 if=foo.dtbo of=/sys/kernel/config/device-tree/overlays/1/dtbo Without this patch, the testcase will result in twice as big buffer in the kernel, which is then passed to the cfs_overlay_item_dtbo_write() . Signed-off-by: Marek Vasut <marex@denx.de> Cc: Geert Uytterhoeven <geert+renesas@glider.be> Cc: Christoph Hellwig <hch@lst.de> Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Diffstat (limited to 'fs/configfs')
-rw-r--r--fs/configfs/file.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index 33b7ee34eda5..bbc1252a59f5 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -357,8 +357,6 @@ configfs_write_bin_file(struct file *file, const char __user *buf,
len = simple_write_to_buffer(buffer->bin_buffer,
buffer->bin_buffer_size, ppos, buf, count);
- if (len > 0)
- *ppos += len;
out:
mutex_unlock(&buffer->mutex);
return len;