Skip to content

Commit 4de930e

Browse files
Al Virodavem330
authored andcommitted
net: validate the range we feed to iov_iter_init() in sys_sendto/sys_recvfrom
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>
1 parent 91edd09 commit 4de930e

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎net/socket.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,6 +1702,8 @@ SYSCALL_DEFINE6(sendto, int, fd, void __user *, buff, size_t, len,
17021702

17031703
if (len > INT_MAX)
17041704
len = INT_MAX;
1705+
if (unlikely(!access_ok(VERIFY_READ, buff, len)))
1706+
return -EFAULT;
17051707
sock = sockfd_lookup_light(fd, &err, &fput_needed);
17061708
if (!sock)
17071709
goto out;
@@ -1760,6 +1762,8 @@ SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size,
17601762

17611763
if (size > INT_MAX)
17621764
size = INT_MAX;
1765+
if (unlikely(!access_ok(VERIFY_WRITE, ubuf, size)))
1766+
return -EFAULT;
17631767
sock = sockfd_lookup_light(fd, &err, &fput_needed);
17641768
if (!sock)
17651769
goto out;

0 commit comments

Comments
 (0)