diff options
author | Mariusz Kozlowski <mk@lab.zgora.pl> | 2010-11-08 14:58:45 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-11-12 22:06:46 +0300 |
commit | 1f18b7176e2e41fada24584ce3c80e9abfaca52b (patch) | |
tree | 4f5cc10413729e16e8965c81afba3ca953ff3642 /net/packet/af_packet.c | |
parent | 7c13a0d9a1ac6875f6380763b947f4a5a016605f (diff) | |
download | linux-1f18b7176e2e41fada24584ce3c80e9abfaca52b.tar.xz |
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>
Diffstat (limited to 'net/packet/af_packet.c')
-rw-r--r-- | net/packet/af_packet.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 0856a13cb53d..8298e676f5a0 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -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); |