Skip to content

Commit c92510f

Browse files
edumazetkuba-moo
authored andcommitted
arp: do not assume dev_hard_header() does not change skb->head
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: db5b4e3 ("ip6_gre: make ip6gre_header() robust") Reported-by: [email protected] Signed-off-by: Eric Dumazet <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 1f20c77 commit c92510f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

net/ipv4/arp.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,20 +564,21 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
564564

565565
skb_reserve(skb, hlen);
566566
skb_reset_network_header(skb);
567-
arp = skb_put(skb, arp_hdr_len(dev));
567+
skb_put(skb, arp_hdr_len(dev));
568568
skb->dev = dev;
569569
skb->protocol = htons(ETH_P_ARP);
570570
if (!src_hw)
571571
src_hw = dev->dev_addr;
572572
if (!dest_hw)
573573
dest_hw = dev->broadcast;
574574

575-
/*
576-
* Fill the device header for the ARP frame
575+
/* Fill the device header for the ARP frame.
576+
* Note: skb->head can be changed.
577577
*/
578578
if (dev_hard_header(skb, dev, ptype, dest_hw, src_hw, skb->len) < 0)
579579
goto out;
580580

581+
arp = arp_hdr(skb);
581582
/*
582583
* Fill out the arp protocol part.
583584
*

0 commit comments

Comments
 (0)