Re: [syzbot] [batman?] KMSAN: uninit-value in skb_clone

From: shaurya
Date: Tue Nov 25 2025 - 12:42:56 EST


#syz test:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
From 9bde86ad2ed63acc09a25e665028dbada7f5f0ac Mon Sep 17 00:00:00 2001
From: Shaurya Rane <ssrane_b23@xxxxxxxxxxxxx>
Date: Tue, 25 Nov 2025 23:02:33 +0530
Subject: [PATCH] hsr: fix NULL pointer dereference in skb_clone with hw tag
insertion

When hardware HSR tag insertion is enabled (NETIF_F_HW_HSR_TAG_INS) and
frame->skb_std is NULL, both hsr_create_tagged_frame() and
prp_create_tagged_frame() will call skb_clone() with a NULL skb pointer,
causing a kernel crash.

Fix this by adding NULL checks for frame->skb_std before calling
skb_clone() in both functions.

Reported-by: syzbot+2fa344348a579b779e05@xxxxxxxxxxxxxxxxxxxxxxxxx
Fixes: f266a683a480 (\"net/hsr: Better frame dispatch\")
Signed-off-by: Shaurya Rane <ssrane_b23@xxxxxxxxxxxxx>
---
net/hsr/hsr_forward.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c
index 339f0d220212..7bd82767c544 100644
--- a/net/hsr/hsr_forward.c
+++ b/net/hsr/hsr_forward.c
@@ -341,6 +341,8 @@ struct sk_buff *hsr_create_tagged_frame(struct hsr_frame_info *frame,
hsr_set_path_id(frame, hsr_ethhdr, port);
return skb_clone(frame->skb_hsr, GFP_ATOMIC);
} else if (port->dev->features & NETIF_F_HW_HSR_TAG_INS) {
+ if (!frame->skb_std)
+ return NULL;
return skb_clone(frame->skb_std, GFP_ATOMIC);
}

@@ -385,6 +387,8 @@ struct sk_buff *prp_create_tagged_frame(struct hsr_frame_info *frame,
}
return skb_clone(frame->skb_prp, GFP_ATOMIC);
} else if (port->dev->features & NETIF_F_HW_HSR_TAG_INS) {
+ if (!frame->skb_std)
+ return NULL;
return skb_clone(frame->skb_std, GFP_ATOMIC);
}

--
2.34.1