netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2] vxlan: fix too large pskb_may_pull with remote checksum
@ 2016-03-21 16:50 Jiri Benc
  2016-03-21 17:32 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jiri Benc @ 2016-03-21 16:50 UTC (permalink / raw)
  To: netdev; +Cc: Tom Herbert

vxlan_remcsum is called after iptunnel_pull_header and thus the skb has
vxlan header already pulled. Don't include vxlan header again in the
calculation.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
v2: Changed wording of the patch description to explain where the header is
    pulled.
---
 drivers/net/vxlan.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 7bfcb9a62a5d..1c0fa364323e 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1143,7 +1143,7 @@ static int vxlan_igmp_leave(struct vxlan_dev *vxlan)
 static bool vxlan_remcsum(struct vxlanhdr *unparsed,
 			  struct sk_buff *skb, u32 vxflags)
 {
-	size_t start, offset, plen;
+	size_t start, offset;
 
 	if (!(unparsed->vx_flags & VXLAN_HF_RCO) || skb->remcsum_offload)
 		goto out;
@@ -1151,9 +1151,7 @@ static bool vxlan_remcsum(struct vxlanhdr *unparsed,
 	start = vxlan_rco_start(unparsed->vx_vni);
 	offset = start + vxlan_rco_offset(unparsed->vx_vni);
 
-	plen = sizeof(struct vxlanhdr) + offset + sizeof(u16);
-
-	if (!pskb_may_pull(skb, plen))
+	if (!pskb_may_pull(skb, offset + sizeof(u16)))
 		return false;
 
 	skb_remcsum_process(skb, (void *)(vxlan_hdr(skb) + 1), start, offset,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net v2] vxlan: fix too large pskb_may_pull with remote checksum
  2016-03-21 16:50 [PATCH net v2] vxlan: fix too large pskb_may_pull with remote checksum Jiri Benc
@ 2016-03-21 17:32 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-03-21 17:32 UTC (permalink / raw)
  To: jbenc; +Cc: netdev, tom

From: Jiri Benc <jbenc@redhat.com>
Date: Mon, 21 Mar 2016 17:50:05 +0100

> vxlan_remcsum is called after iptunnel_pull_header and thus the skb has
> vxlan header already pulled. Don't include vxlan header again in the
> calculation.
> 
> Signed-off-by: Jiri Benc <jbenc@redhat.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-21 17:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-21 16:50 [PATCH net v2] vxlan: fix too large pskb_may_pull with remote checksum Jiri Benc
2016-03-21 17:32 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).