Skip to content

Commit 0299355

Browse files
edumazetgregkh
authored andcommitted
arp: do not assume dev_hard_header() does not change skb->head
[ Upstream commit c92510f5e3f82ba11c95991824a41e59a9c5ed81 ] 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: syzbot+58b44a770a1585795351@syzkaller.appspotmail.com Signed-off-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20260107212250.384552-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 0d254b0 commit 0299355

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
@@ -563,20 +563,21 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
563563

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

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

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

0 commit comments

Comments
 (0)