summaryrefslogtreecommitdiff
path: root/target/linux/brcm2708/patches-4.4/0568-configfs-Remove-ppos-increment-in-configfs_write_bin.patch
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2017-02-06 17:12:09 +0100
committerÁlvaro Fernández Rojas <noltari@gmail.com>2017-02-06 22:24:42 +0100
commitdab5a4406799633a319381b0127e1fda82b15c02 (patch)
tree7d100dfd99914c1195ccada0f62387d4fced8563 /target/linux/brcm2708/patches-4.4/0568-configfs-Remove-ppos-increment-in-configfs_write_bin.patch
parent6b01f0f196c0c1ff43c362e9aef4433eacbbb8c6 (diff)
downloadmtk-20170518-dab5a4406799633a319381b0127e1fda82b15c02.zip
mtk-20170518-dab5a4406799633a319381b0127e1fda82b15c02.tar.gz
mtk-20170518-dab5a4406799633a319381b0127e1fda82b15c02.tar.bz2
brcm2708: update linux 4.4 patches to latest version
n As usual these patches were extracted and rebased from the raspberry pi repo: https://github.com/raspberrypi/linux/tree/rpi-4.4.y Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/brcm2708/patches-4.4/0568-configfs-Remove-ppos-increment-in-configfs_write_bin.patch')
-rw-r--r--target/linux/brcm2708/patches-4.4/0568-configfs-Remove-ppos-increment-in-configfs_write_bin.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/target/linux/brcm2708/patches-4.4/0568-configfs-Remove-ppos-increment-in-configfs_write_bin.patch b/target/linux/brcm2708/patches-4.4/0568-configfs-Remove-ppos-increment-in-configfs_write_bin.patch
new file mode 100644
index 0000000..842cb8b
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0568-configfs-Remove-ppos-increment-in-configfs_write_bin.patch
@@ -0,0 +1,49 @@
+From ec490344ba1906dfdbbb6baaa0349fe2ad3d463d Mon Sep 17 00:00:00 2001
+From: Marek Vasut <marex@denx.de>
+Date: Wed, 18 May 2016 16:16:51 +0200
+Subject: [PATCH] configfs: Remove ppos increment in configfs_write_bin_file
+
+[ Back-port of f8608985f851c917b3884b692d8e326b0210d34e ]
+
+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>
+---
+ fs/configfs/file.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/fs/configfs/file.c
++++ b/fs/configfs/file.c
+@@ -357,8 +357,6 @@ configfs_write_bin_file(struct file *fil
+
+ 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;