lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140530203332.GA23463@moon>
Date:	Sat, 31 May 2014 00:33:32 +0400
From:	Cyrill Gorcunov <gorcunov@...il.com>
To:	Al Viro <viro@...IV.linux.org.uk>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
	Pavel Emelyanov <xemul@...allels.com>
Subject: [PATCH -next] fs: pipe -- Take into account requested @len in
 iter_file_splice_write

Currently iter_file_splice_write pushes into the output IOVs as much
as it can, so that if one previously pushed into pipe 8K of data and
then try to fetch 4K -- he get the complete 8K instead.

Lest count how many bytes were requested by a caller and
stop looping once request is complete.

Signed-off-by: Cyrill Gorcunov <gorcunov@...nvz.org>
CC: Al Viro <viro@...IV.linux.org.uk>
CC: Andrew Morton <akpm@...ux-foundation.org>
CC: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
CC: Pavel Emelyanov <xemul@...allels.com>
---

Al, take a look please, hope I didn't do something stupid.
Here was a testcase https://lkml.org/lkml/2014/5/27/167

 fs/splice.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6.git/fs/splice.c
===================================================================
--- linux-2.6.git.orig/fs/splice.c
+++ linux-2.6.git/fs/splice.c
@@ -979,14 +979,14 @@ iter_file_splice_write(struct pipe_inode
 				break;
 			}
 		}
-				
+
 		/* build the vector */
-		for (n = 0, idx = pipe->curbuf; n < pipe->nrbufs; n++, idx++) {
+		for (n = 0, idx = pipe->curbuf; count < sd.total_len && n < pipe->nrbufs; n++, idx++) {
 			struct pipe_buffer *buf = pipe->bufs + idx;
 			size_t this_len = buf->len;
 
-			if (this_len > sd.total_len)
-				this_len = sd.total_len;
+			if (this_len + count > sd.total_len)
+				this_len = sd.total_len - count;
 
 			if (idx == pipe->buffers - 1)
 				idx = -1;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ