Skip to content

Commit 2d36f6b

Browse files
edumazetUlrich Hecht
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> Signed-off-by: Ulrich Hecht <uli@kernel.org>
1 parent 5a482c9 commit 2d36f6b

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

545545
skb_reserve(skb, hlen);
546546
skb_reset_network_header(skb);
547-
arp = skb_put(skb, arp_hdr_len(dev));
547+
skb_put(skb, arp_hdr_len(dev));
548548
skb->dev = dev;
549549
skb->protocol = htons(ETH_P_ARP);
550550
if (!src_hw)
551551
src_hw = dev->dev_addr;
552552
if (!dest_hw)
553553
dest_hw = dev->broadcast;
554554

555-
/*
556-
* Fill the device header for the ARP frame
555+
/* Fill the device header for the ARP frame.
556+
* Note: skb->head can be changed.
557557
*/
558558
if (dev_hard_header(skb, dev, ptype, dest_hw, src_hw, skb->len) < 0)
559559
goto out;
560560

561+
arp = arp_hdr(skb);
561562
/*
562563
* Fill out the arp protocol part.
563564
*

0 commit comments

Comments
 (0)