Skip to content

Commit

Permalink
net: Fix header size check for GSO case in recvmsg (af_packet)
Browse files Browse the repository at this point in the history
Parameter 'len' is size_t type so it will never get negative.

Signed-off-by: Mariusz Kozlowski <mk@lab.zgora.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Mariusz Kozlowski authored and David S. Miller committed Nov 12, 2010
1 parent 7c13a0d commit 1f18b71
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/packet/af_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1610,9 +1610,11 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock,

err = -EINVAL;
vnet_hdr_len = sizeof(vnet_hdr);
if ((len -= vnet_hdr_len) < 0)
if (len < vnet_hdr_len)
goto out_free;

len -= vnet_hdr_len;

if (skb_is_gso(skb)) {
struct skb_shared_info *sinfo = skb_shinfo(skb);

Expand Down

0 comments on commit 1f18b71

Please sign in to comment.