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] net: fix NULL dereference in skb realloc fault injection devname filter
Date: Fri, 2 Oct 2026 03:30:18 -0700 [thread overview]
Message-ID: <ar-Hj5DhKuZeUisY@gmail.com> (raw)
In-Reply-To: <20260930122013.110284-1-yanhaishuang@cmss.chinamobile.com>
> --- a/net/core/skb_fault_injection.c
> +++ b/net/core/skb_fault_injection.c
> @@ -19,8 +19,8 @@ static bool should_fail_net_realloc_skb(struct sk_buff *skb)
> struct net_device *net = skb->dev;
>
> if (skb_realloc.filtered &&
> - strncmp(net->name, skb_realloc.devname, IFNAMSIZ))
> - /* device name filter set, but names do not match */
> + (!net || strncmp(net->name, skb_realloc.devname, IFNAMSIZ)))
> + /* device name filter set, but no device or names do not match */
> return false;
>
> if (!should_fail(&skb_realloc.attr, 1))
I think something like this untested approach reads better:
diff --git a/net/core/skb_fault_injection.c b/net/core/skb_fault_injection.c
index 4235db6bdfad55..63a397f761133c 100644
--- a/net/core/skb_fault_injection.c
+++ b/net/core/skb_fault_injection.c
@@ -18,6 +18,9 @@ static bool should_fail_net_realloc_skb(struct sk_buff *skb)
{
struct net_device *net = skb->dev;
+ if (!net)
+ return false;
+
if (skb_realloc.filtered &&
strncmp(net->name, skb_realloc.devname, IFNAMSIZ))
/* device name filter set, but names do not match */
next prev parent reply other threads:[~2026-10-02 10:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 12:20 Haishuang Yan
2026-10-01 18:28 ` [PATCH net v2] " Haishuang Yan
2026-10-02 10:30 ` Breno Leitao [this message]
2026-10-01 18:44 ` [PATCH net] " Haishuang Yan
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=ar-Hj5DhKuZeUisY@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®