Commit 7d34fa75 authored by Jiri Benc's avatar Jiri Benc Committed by David S. Miller

vxlan: fix too large pskb_may_pull with remote checksum

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: default avatarJiri Benc <jbenc@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5692d7ea
...@@ -1143,7 +1143,7 @@ static int vxlan_igmp_leave(struct vxlan_dev *vxlan) ...@@ -1143,7 +1143,7 @@ static int vxlan_igmp_leave(struct vxlan_dev *vxlan)
static bool vxlan_remcsum(struct vxlanhdr *unparsed, static bool vxlan_remcsum(struct vxlanhdr *unparsed,
struct sk_buff *skb, u32 vxflags) 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) if (!(unparsed->vx_flags & VXLAN_HF_RCO) || skb->remcsum_offload)
goto out; goto out;
...@@ -1151,9 +1151,7 @@ static bool vxlan_remcsum(struct vxlanhdr *unparsed, ...@@ -1151,9 +1151,7 @@ static bool vxlan_remcsum(struct vxlanhdr *unparsed,
start = vxlan_rco_start(unparsed->vx_vni); start = vxlan_rco_start(unparsed->vx_vni);
offset = start + vxlan_rco_offset(unparsed->vx_vni); offset = start + vxlan_rco_offset(unparsed->vx_vni);
plen = sizeof(struct vxlanhdr) + offset + sizeof(u16); if (!pskb_may_pull(skb, offset + sizeof(u16)))
if (!pskb_may_pull(skb, plen))
return false; return false;
skb_remcsum_process(skb, (void *)(vxlan_hdr(skb) + 1), start, offset, skb_remcsum_process(skb, (void *)(vxlan_hdr(skb) + 1), start, offset,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment