diff options
author | David S. Miller <davem@davemloft.net> | 2010-09-27 20:24:54 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-28 21:44:07 -0700 |
commit | 237a9f8f234fde5441f1102b8820b8425f4c1e16 (patch) | |
tree | 4955937bab9f283dd172fa97831ae04e00ff0651 /net | |
parent | 0a3f7a263b2b89e285e173073f15f70da5396063 (diff) |
tcp: Fix >4GB writes on 64-bit.
[ Upstream commit 01db403cf99f739f86903314a489fb420e0e254f ]
Fixes kernel bugzilla #16603
tcp_sendmsg() truncates iov_len to an 'int' which a 4GB write to write
zero bytes, for example.
There is also the problem higher up of how verify_iovec() works. It
wants to prevent the total length from looking like an error return
value.
However it does this using 'int', but syscalls return 'long' (and
thus signed 64-bit on 64-bit machines). So it could trigger
false-positives on 64-bit as written. So fix it to use 'long'.
Reported-by: Olaf Bonorden <bono@onlinehome.de>
Reported-by: Daniel Büse <dbuese@gmx.de>
Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/iovec.c | 5 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/net/core/iovec.c b/net/core/iovec.c index 16ad45d4882..8cee101bc4d 100644 --- a/net/core/iovec.c +++ b/net/core/iovec.c @@ -36,9 +36,10 @@ * in any case. */ -int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode) +long verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode) { - int size, err, ct; + int size, ct; + long err; if (m->msg_namelen) { if (mode == VERIFY_READ) { diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 108fad07319..0a65f5b2e23 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -935,7 +935,7 @@ int tcp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, goto out_err; while (--iovlen >= 0) { - int seglen = iov->iov_len; + size_t seglen = iov->iov_len; unsigned char __user *from = iov->iov_base; iov++; |