arp: do not assume dev_hard_header() does not change skb->head
Subsystems (3)
PATCH 1/1 arp: do not assume dev_hard_header() does not change skb->head
From: Eric Dumazet <[email protected]>
arp_create() is the only dev_hard_header() caller making assumption about skb->head being unchanged.
A recent commit broke this assumption.
Initialize @arp pointer after dev_hard_header() call.
Fixes db5b4e39c4e6 ("ip6_gre: make ip6gre_header() robust")
Reported-by [email protected]
Signed-off-by Eric Dumazet <[email protected]>
Signed-off-by Jakub Kicinski <[email protected]>
Signed-off-by Jay Wang <[email protected]>
--- net/ipv4/arp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/ipv4/arp.c +4 -3
@@ -564,7 +564,7 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,skb_reserve (skb, hlen);skb_reset_network_header (skb); - arp =skb_put (skb,arp_hdr_len (dev)); +skb_put (skb,arp_hdr_len (dev)); skb->dev = dev; skb->protocol =htons (ETH_P_ARP );if (!src_hw)
@@ -572,12 +572,13 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,if (!dest_hw) dest_hw = dev->broadcast; -/* -* Fill the device header for the ARP frame +/* Fill the device header for the ARP frame. +* Note: skb->head can be changed. */ if (dev_hard_header (skb, dev, ptype, dest_hw, src_hw, skb->len) <0 ) goto out; + arp =arp_hdr (skb);/* * Fill out the arp protocol part. *
Signature · 1 line
2.47.3