Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jiayuan Chen <jiayuan.chen@linux.dev>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	Petr Machata <petrm@nvidia.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] netdevsim: fix panic when NETIF_F_LOOPBACK is set on a VF port
Date: Mon, 31 Aug 2026 20:16:38 -0700	[thread overview]
Message-ID: <20260831201638.3bcaefcd@kernel.org> (raw)
In-Reply-To: <20260831042221.137137-1-jiayuan.chen@linux.dev>

On Mon, 31 Aug 2026 12:22:20 +0800 Jiayuan Chen wrote:
> A netdevsim VF port cannot process incoming data.  It never runs
> nsim_queue_init(), so ns->rq is NULL, and nsim_vf_netdev_ops has no
> ->ndo_open, so its NAPI is never set up either.  
> 
> Since commit 358008f41d9b ("netdevsim: add loopback support") an outgoing
> netdevsim can also be the incoming device.  nsim_setup() is shared by PF
> and VF ports and offers NETIF_F_LOOPBACK to both, so the feature can be
> turned on for a VF; nsim_start_xmit() then takes ns as peer_ns and
> dereferences peer_ns->rq[], which panics.

None of the offloads are there either, hm.. VF already has its own
net_device_ops struct. Let's replace:

       .ndo_start_xmit         = nsim_start_xmit,

with some dedicated nsim_start_xmit_vf() which unconditionally
drops the traffic? Even if we clear the LOOPBACK it will be easy
to re-introduce the bug by adding some PF-only code in the PF xmit.
-- 
pw-bot: cr

      reply	other threads:[~2026-09-01  3:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31  4:22 [PATCH net] netdevsim: fix panic when NETIF_F_LOOPBACK is set on a VF port Jiayuan Chen
2026-09-01  3:16 ` Jakub Kicinski [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=20260831201638.3bcaefcd@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiayuan.chen@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=willemb@google.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