From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Shaunak Datar <shaunakkdatar@gmail.com>,
mkl@pengutronix.de, mailhol@kernel.org
Cc: pabeni@redhat.com, linux-can@vger.kernel.org,
linux-kernel@vger.kernel.org,
syzbot+1aae11dc8d42ec1a87ec@syzkaller.appspotmail.com
Subject: Re: [PATCH] can: dev: fix missing skb header initialization in init_can_skb
Date: Fri, 18 Sep 2026 19:33:41 +0200 [thread overview]
Message-ID: <490282e1-a6dd-40ee-8be7-0a311b2b0141@hartkopp.net> (raw)
In-Reply-To: <20260918151606.765490-1-shaunakkdatar@gmail.com>
Hallo Shaunak,
many thanks for your patch. But there's already a fix awaiting upstream:
https://lore.kernel.org/linux-can/20260917123716.63116-1-ndaugoing@gmail.com/
Best regards,
Oliver
On 18.09.26 17:16, Shaunak Datar wrote:
> __alloc_skb() sets skb->mac_header to (typeof(skb->mac_header))~0U via
> __finalize_skb_around(). skb_reset_mac_len() checks if the value has been
> updated via the skb_mac_header_was_set() and fires
> DEBUG_NET_WARN_ON_ONCE(1) if not.
>
> init_can_skb() previously included three header reset calls:
>
> - skb_reset_mac_header(skb)
> - skb_reset_network_header(skb)
> - skb_reset_transport_header(skb)
>
> Commit 9f10374bb024 ("can: remove private CAN skb headroom
> infrastructure") dropped these calls which leads to the skb->mac_header
> retaining the original value.
>
> Restore the three missing calls in the init_can_skb().
>
> Fixes: 9f10374bb024 ("can: remove private CAN skb headroom infrastructure")
> Reported-by: syzbot+1aae11dc8d42ec1a87ec@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=1aae11dc8d42ec1a87ec
> Signed-off-by: Shaunak Datar <shaunakkdatar@gmail.com>
> ---
> drivers/net/can/dev/skb.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/can/dev/skb.c b/drivers/net/can/dev/skb.c
> index 95fcdc1026f8..9cbddc1edd41 100644
> --- a/drivers/net/can/dev/skb.c
> +++ b/drivers/net/can/dev/skb.c
> @@ -210,6 +210,9 @@ static void init_can_skb(struct sk_buff *skb)
> {
> skb->pkt_type = PACKET_BROADCAST;
> skb->ip_summed = CHECKSUM_UNNECESSARY;
> + skb_reset_mac_header(skb);
> + skb_reset_network_header(skb);
> + skb_reset_transport_header(skb);
> }
>
> struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf)
prev parent reply other threads:[~2026-09-18 17:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 15:16 Shaunak Datar
2026-09-18 17:33 ` Oliver Hartkopp [this message]
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=490282e1-a6dd-40ee-8be7-0a311b2b0141@hartkopp.net \
--to=socketcan@hartkopp.net \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=mkl@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=shaunakkdatar@gmail.com \
--cc=syzbot+1aae11dc8d42ec1a87ec@syzkaller.appspotmail.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
all inboxes | Powered by JetHome®