Skip to content

Commit 25adf4e

Browse files
xairygregkh
authored andcommitted
net/packet: fix overflow in check for tp_reserve
[ Upstream commit bcc5364bdcfe131e6379363f089e7b4108d35b70 ] When calculating po->tp_hdrlen + po->tp_reserve the result can overflow. Fix by checking that tp_reserve <= INT_MAX on assign. Signed-off-by: Andrey Konovalov <andreyknvl@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent cf71bd4 commit 25adf4e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

net/packet/af_packet.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3626,6 +3626,8 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
36263626
return -EBUSY;
36273627
if (copy_from_user(&val, optval, sizeof(val)))
36283628
return -EFAULT;
3629+
if (val > INT_MAX)
3630+
return -EINVAL;
36293631
po->tp_reserve = val;
36303632
return 0;
36313633
}

0 commit comments

Comments
 (0)