summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorMariusz Kozlowski <mk@lab.zgora.pl>2010-11-08 11:58:45 +0000
committerAK <andi@firstfloor.org>2011-02-06 11:03:39 -0800
commit64c80cfe40b35c06a7cbf2806fcc2c14460405ab (patch)
tree0435732b9a48dbd6c14906b5e3debde2c0afd6f2 /net
parent44a913f55f16aa0495a378f62252512cf3ad4b29 (diff)
net: Fix header size check for GSO case in recvmsg (af_packet)
[ Upstream commit 1f18b7176e2e41fada24584ce3c80e9abfaca52b] 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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Andi Kleen <ak@linux.intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/packet/af_packet.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 2078a277e06b..e670cb211491 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1595,9 +1595,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);