Commit 1f18b7176e2e41fada24584ce3c80e9abfaca52b

Authored by Mariusz Kozlowski
Committed by David S. Miller
1 parent 7c13a0d9a1

net: Fix header size check for GSO case in recvmsg (af_packet)

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>

Showing 1 changed file with 3 additions and 1 deletions Side-by-side Diff

net/packet/af_packet.c
... ... @@ -1610,8 +1610,10 @@
1610 1610  
1611 1611 err = -EINVAL;
1612 1612 vnet_hdr_len = sizeof(vnet_hdr);
1613   - if ((len -= vnet_hdr_len) < 0)
  1613 + if (len < vnet_hdr_len)
1614 1614 goto out_free;
  1615 +
  1616 + len -= vnet_hdr_len;
1615 1617  
1616 1618 if (skb_is_gso(skb)) {
1617 1619 struct skb_shared_info *sinfo = skb_shinfo(skb);