From: Soheil Hassas Yeganeh Date: Fri, 4 Nov 2016 19:36:49 +0000 (-0400) Subject: sock: fix sendmmsg for partial sendmsg X-Git-Tag: v3.2.87~29 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=058627c4b45f3d3b34925cf1217c7e519967fad6;p=pandora-kernel.git sock: fix sendmmsg for partial sendmsg [ Upstream commit 3023898b7d4aac65987bd2f485cc22390aae6f78 ] Do not send the next message in sendmmsg for partial sendmsg invocations. sendmmsg assumes that it can continue sending the next message when the return value of the individual sendmsg invocations is positive. It results in corrupting the data for TCP, SCTP, and UNIX streams. For example, sendmmsg([["abcd"], ["efgh"]]) can result in a stream of "aefgh" if the first sendmsg invocation sends only the first byte while the second sendmsg goes through. Datagram sockets either send the entire datagram or fail, so this patch affects only sockets of type SOCK_STREAM and SOCK_SEQPACKET. Fixes: 228e548e6020 ("net: Add sendmmsg socket system call") Signed-off-by: Soheil Hassas Yeganeh Signed-off-by: Eric Dumazet Signed-off-by: Willem de Bruijn Signed-off-by: Neal Cardwell Acked-by: Maciej Żenczykowski Signed-off-by: David S. Miller [bwh: Backported to 3.2: we don't have the iov_iter API, so make ___sys_sendmsg() calculate and write back the remaining length] Signed-off-by: Ben Hutchings --- Reading git-diff-tree failed