From: Ido Schimmel <idosch@nvidia.com>
To: Hyunwoo Kim <imv4bel@gmail.com>
Cc: dsahern@kernel.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
steffen.klassert@secunet.com, herbert@gondor.apana.org.au,
andrew+netdev@lunn.ch, kuniyu@google.com, jlayton@kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH net v2] net: protect egress device access in the output path with rcu_read_lock
Date: Tue, 2 Jun 2026 18:45:23 +0300 [thread overview]
Message-ID: <20260602154523.GA537996@shredder> (raw)
In-Reply-To: <ahveCu-zzFlpeVut@v4bel>
On Sun, May 31, 2026 at 04:06:50PM +0900, Hyunwoo Kim wrote:
> drivers/net/vrf.c | 16 +++++++++++-----
> net/ipv4/ip_output.c | 27 +++++++++++++++++++--------
> net/ipv4/raw.c | 4 +++-
> net/ipv4/xfrm4_output.c | 13 +++++++++----
> net/xfrm/xfrm_output.c | 4 +++-
> 5 files changed, 45 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
> index 46209917ae4d..e9a1dd961805 100644
> --- a/drivers/net/vrf.c
> +++ b/drivers/net/vrf.c
> @@ -833,17 +833,23 @@ static int vrf_finish_output(struct net *net, struct sock *sk, struct sk_buff *s
>
> static int vrf_output(struct net *net, struct sock *sk, struct sk_buff *skb)
> {
> - struct net_device *dev = skb_dst(skb)->dev;
> + struct net_device *dev;
> + int ret;
> +
> + rcu_read_lock();
> + dev = skb_dst_dev_rcu(skb);
>
> IP_UPD_PO_STATS(net, IPSTATS_MIB_OUT, skb->len);
>
> skb->dev = dev;
> skb->protocol = htons(ETH_P_IP);
>
> - return NF_HOOK_COND(NFPROTO_IPV4, NF_INET_POST_ROUTING,
> - net, sk, skb, NULL, dev,
> - vrf_finish_output,
> - !(IPCB(skb)->flags & IPSKB_REROUTED));
> + ret = NF_HOOK_COND(NFPROTO_IPV4, NF_INET_POST_ROUTING,
> + net, sk, skb, NULL, dev,
> + vrf_finish_output,
> + !(IPCB(skb)->flags & IPSKB_REROUTED));
> + rcu_read_unlock();
> + return ret;
> }
Patch LGTM, thanks, but what about the IPv6 counterpart (vrf_output6())
and the other similar existing issues that Sashiko is flagging?
next prev parent reply other threads:[~2026-06-02 15:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-31 7:06 [PATCH net v2] net: protect egress device access in the output path with rcu_read_lock Hyunwoo Kim
2026-06-02 15:45 ` Ido Schimmel [this message]
2026-06-02 16:24 ` David Ahern
2026-06-03 12:58 ` Hyunwoo Kim
2026-06-03 14:52 ` David Ahern
2026-06-04 1:28 ` Herbert Xu
2026-06-04 2:25 ` Herbert Xu
2026-06-04 12:27 ` Ido Schimmel
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=20260602154523.GA537996@shredder \
--to=idosch@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=imv4bel@gmail.com \
--cc=jlayton@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=steffen.klassert@secunet.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.