diff options
author | Al Viro <viro@ZenIV.linux.org.uk> | 2015-03-20 17:41:43 +0000 |
---|---|---|
committer | Simon Shields <keepcalm444@gmail.com> | 2016-06-30 18:28:23 +1000 |
commit | 29bb56e2cc91e8a9a1d44cd14fe04c48f77cce66 (patch) | |
tree | 225481f70768fa67479f146e277096231aefead0 /net | |
parent | 219a2d78a8bc79df201c45a78a5ece714c002704 (diff) | |
download | kernel_samsung_smdk4412-29bb56e2cc91e8a9a1d44cd14fe04c48f77cce66.zip kernel_samsung_smdk4412-29bb56e2cc91e8a9a1d44cd14fe04c48f77cce66.tar.gz kernel_samsung_smdk4412-29bb56e2cc91e8a9a1d44cd14fe04c48f77cce66.tar.bz2 |
net: validate the range we feed to iov_iter_init() in sys_sendto/sys_recvfrom
Change-Id: Ida19e5102b7faca17c685a261c20fbbf5c9614f9
Cc: stable@vger.kernel.org # v3.19
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/socket.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c index e4c7f90..53882f7 100644 --- a/net/socket.c +++ b/net/socket.c @@ -1683,6 +1683,8 @@ SYSCALL_DEFINE6(sendto, int, fd, void __user *, buff, size_t, len, if (len > INT_MAX) len = INT_MAX; + if (unlikely(!access_ok(VERIFY_READ, buff, len))) + return -EFAULT; sock = sockfd_lookup_light(fd, &err, &fput_needed); if (!sock) goto out; @@ -1742,6 +1744,8 @@ SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size, if (size > INT_MAX) size = INT_MAX; + if (unlikely(!access_ok(VERIFY_WRITE, ubuf, size))) + return -EFAULT; sock = sockfd_lookup_light(fd, &err, &fput_needed); if (!sock) goto out; |