From: Breno Leitao <leitao@debian.org>
To: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Guillaume Nault <gnault@redhat.com>,
Akinobu Mita <akinobu.mita@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v3] net: fix NULL dereference in skb realloc fault injection devname filter
Date: Wed, 7 Oct 2026 02:01:51 -0700 [thread overview]
Message-ID: <asYKFJZY45h52BhY@gmail.com> (raw)
In-Reply-To: <20261007004158.1266795-1-yanhaishuang@cmss.chinamobile.com>
On Wed, Oct 07, 2026 at 08:41:58AM +0800, Haishuang Yan wrote:
> When a device name filter is set in
> /sys/kernel/debug/fail_skb_realloc/devname, should_fail_net_realloc_skb()
> compares it with skb->dev->name without checking skb->dev first.
>
> skb_might_realloc() is called from pskb_may_pull(), pskb_trim() and
> pskb_trim_rcsum(), which also run on skbs that are not associated with
> a device. One example is a netlink broadcast to a listener with a socket
> filter attached, which goes through sk_filter_trim_cap(). With the
> filter set, such an skb makes the kernel oops:
>
> KASAN: null-ptr-deref in range [0x0000000000000118-0x000000000000011f]
> pc : strncmp+0x50/0xf0
> lr : skb_might_realloc+0x58/0xa0
> Call trace:
> strncmp+0x50/0xf0 (P)
> skb_might_realloc+0x58/0xa0
> sk_filter_trim_cap+0x6a0/0x928
> do_one_broadcast+0x35c/0xb20
> netlink_broadcast_filtered+0x1a4/0x328
> netlink_sendmsg+0x724/0xa58
>
> The fault is meant to be injected on network interfaces, so skip skbs
> that are not associated with a device. Without a device name filter,
> such skbs are no longer reallocated either.
>
> Fixes: 12079a59ce52 ("net: Implement fault injection forcing skb reallocation")
> Suggested-by: Breno Leitao <leitao@debian.org>
> Assisted-by: LLM
> Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Reviewed-by: Breno Leitao <leitao@debian.org>
prev parent reply other threads:[~2026-10-07 9:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 0:41 Haishuang Yan
2026-10-07 9:01 ` Breno Leitao [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=asYKFJZY45h52BhY@gmail.com \
--to=leitao@debian.org \
--cc=akinobu.mita@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=gnault@redhat.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=yanhaishuang@cmss.chinamobile.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®