public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: shaurya <ssranevjti@gmail.com>
To: syzbot+2fa344348a579b779e05@syzkaller.appspotmail.com
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [batman?] KMSAN: uninit-value in skb_clone
Date: Wed, 26 Nov 2025 01:33:41 +0530	[thread overview]
Message-ID: <38778a8e-ddd2-44a6-8d45-d6871de34f30@gmail.com> (raw)
In-Reply-To: <6925da1b.a70a0220.d98e3.00af.GAE@google.com>

[-- Attachment #1: Type: text/plain, Size: 83 bytes --]

#syz test:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

[-- Attachment #2: 0001-hsr-fix-NULL-pointer-dereference-in-skb_clone-with-h.patch --]
[-- Type: text/x-patch, Size: 1883 bytes --]

From ff66dd840d93efe5914a824b0d4d58031115d788 Mon Sep 17 00:00:00 2001
From: Shaurya Rane <ssrane_b23@ee.vjti.ac.in>
Date: Wed, 26 Nov 2025 01:25:03 +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 the functions.

Reported-by: syzbot+2fa344348a579b779e05@syzkaller.appspotmail.com
Fixes: f266a683a480 (\"net/hsr: Better frame dispatch\")

Signed-off-by: Shaurya Rane <ssrane_b23@ee.vjti.ac.in>
---
 net/hsr/hsr_forward.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c
index 339f0d220212..4c1a311b900f 100644
--- a/net/hsr/hsr_forward.c
+++ b/net/hsr/hsr_forward.c
@@ -211,6 +211,9 @@ struct sk_buff *prp_get_untagged_frame(struct hsr_frame_info *frame,
 				  __FILE__, __LINE__, port->dev->name);
 			return NULL;
 		}
+
+		if (!frame->skb_std)
+			return NULL;
 	}
 
 	return skb_clone(frame->skb_std, GFP_ATOMIC);
@@ -341,6 +344,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 +390,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


  parent reply	other threads:[~2025-11-25 20:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-25 16:32 [syzbot] [batman?] KMSAN: uninit-value in skb_clone syzbot
2025-11-25 17:42 ` shaurya
2025-11-25 17:59   ` syzbot
2025-11-25 20:03 ` shaurya [this message]
2025-11-25 20:25   ` syzbot
2025-11-29 16:01 ` shaurya
2025-11-29 16:23   ` syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=38778a8e-ddd2-44a6-8d45-d6871de34f30@gmail.com \
    --to=ssranevjti@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=syzbot+2fa344348a579b779e05@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox