Permalink
Browse files

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>
  • Loading branch information...
Al Viro authored and andi34 committed Mar 20, 2015
1 parent 5c6ad48 commit 006af84bc825c08235b7825c84d09e5efbd194f0
Showing with 4 additions and 0 deletions.
  1. +4 −0 net/socket.c
View
@@ -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;

0 comments on commit 006af84

Please sign in to comment.