diff mbox

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

Message ID 1289253525-7020-1-git-send-email-mk@lab.zgora.pl
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Mariusz Kozlowski Nov. 8, 2010, 9:58 p.m. UTC
Parameter 'len' is size_t type so it will never get negative.

Signed-off-by: Mariusz Kozlowski <mk@lab.zgora.pl>
---
 net/packet/af_packet.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Comments

David Miller Nov. 10, 2010, 8:53 p.m. UTC | #1
From: Mariusz Kozlowski <mk@lab.zgora.pl>
Date: Mon,  8 Nov 2010 22:58:45 +0100

> Parameter 'len' is size_t type so it will never get negative.
> 
> Signed-off-by: Mariusz Kozlowski <mk@lab.zgora.pl>

Applied, thank you!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 3616f27..3451191 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);