public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Ido Schimmel <idosch@nvidia.com>, netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	edumazet@google.com, andrew+netdev@lunn.ch, petrm@nvidia.com,
	lirongqing@baidu.com
Subject: Re: [PATCH net-next v2 3/3] vrf: Remove unnecessary RCU protection around dst entries
Date: Fri, 27 Mar 2026 08:56:03 -0600	[thread overview]
Message-ID: <23856f10-6f3c-471c-b262-af117de1dbaa@kernel.org> (raw)
In-Reply-To: <20260326203233.1128554-4-idosch@nvidia.com>

On 3/26/26 2:32 PM, Ido Schimmel wrote:
> During initialization of a VRF device, the VRF driver creates two dst
> entries (for IPv4 and IPv6). They are attached to locally generated
> packets that are transmitted out of the VRF ports (via the
> l3mdev_l3_out() hook). Their purpose is to redirect packets towards the
> VRF device instead of having the packets egress directly out of the VRF
> ports. This is useful, for example, when a queuing discipline is
> configured on the VRF device.
> 
> In order to avoid a NULL pointer dereference, commit b0e95ccdd775 ("net:
> vrf: protect changes to private data with rcu") made the pointers to the
> dst entries RCU protected. As far as I can tell, this was needed because
> back then the dst entries were released (and the pointers reset to NULL)
> before removing the VRF ports.
> 
> Later on, commit f630c38ef0d7 ("vrf: fix bug_on triggered by rx when
> destroying a vrf") moved the removal of the VRF ports to the VRF
> device's dellink() callback. As such, the tear down sequence of a VRF
> device looks as follows:
> 
> 1. VRF ports are removed.
> 2. VRF device is unregistered.
>     a. Device is closed.
>     b. An RCU grace period passes.
>     c. ndo_uninit() is called.
>         i. dst entries are released.
> 
> Given the above, the Tx path will always see the same fully initialized
> dst entries and will never race with the ndo_uninit() callback.
> 
> Therefore, there is no need to make the pointers to the dst entries RCU
> protected. Remove it as well as the unnecessary NULL checks in the Tx
> path.
> 
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> ---
>  drivers/net/vrf.c | 56 ++++++++++-------------------------------------
>  1 file changed, 12 insertions(+), 44 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>



  reply	other threads:[~2026-03-27 14:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26 20:32 [PATCH net-next v2 0/3] vrf: A few cleanups Ido Schimmel
2026-03-26 20:32 ` [PATCH net-next v2 1/3] vrf: Remove unnecessary NULL check Ido Schimmel
2026-03-26 20:32 ` [PATCH net-next v2 2/3] vrf: Use dst_dev_put() instead of using loopback device Ido Schimmel
2026-03-26 20:32 ` [PATCH net-next v2 3/3] vrf: Remove unnecessary RCU protection around dst entries Ido Schimmel
2026-03-27 14:56   ` David Ahern [this message]
2026-03-28  4:10 ` [PATCH net-next v2 0/3] vrf: A few cleanups patchwork-bot+netdevbpf

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=23856f10-6f3c-471c-b262-af117de1dbaa@kernel.org \
    --to=dsahern@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=lirongqing@baidu.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.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