From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Sechang Lim <rhkrqnwk98@gmail.com>
Cc: <willemdebruijn.kernel@gmail.com>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
<horms@kernel.org>, <daniel@iogearbox.net>,
<cong.wang@bytedance.com>, <john.fastabend@gmail.com>,
<jakub@cloudflare.com>, <netdev@vger.kernel.org>,
<bpf@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net] udp: clear skb->dev before running a sockmap verdict
Date: Wed, 3 Jun 2026 15:48:02 +0200 [thread overview]
Message-ID: <423d23d2-b2ba-4a33-96f1-a1e21437484a@intel.com> (raw)
In-Reply-To: <20260603122639.615994-1-rhkrqnwk98@gmail.com>
From: Sechang Lim <rhkrqnwk98@gmail.com>
Date: Wed, 3 Jun 2026 12:26:37 +0000
> On the UDP receive path skb->dev is repurposed as dev_scratch (the
> truesize/state cache set by udp_set_dev_scratch()), through the
> union { struct net_device *dev; unsigned long dev_scratch; } in sk_buff.
[...]
> Fixes: 965b57b469a5 ("net: Introduce a new proto_ops ->read_skb()")
I think you need to add
Cc: stable@vger.kernel.org
here to mark it as a candidate for backporting.
> Signed-off-by: Sechang Lim <rhkrqnwk98@gmail.com>
> ---
> net/ipv4/udp.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index 0ac2bf4f8759..f5ba36e721cb 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -2011,6 +2011,11 @@ int udp_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
> }
>
> WARN_ON_ONCE(!skb_set_owner_sk_safe(skb, sk));
> + /* skb->dev still aliases the UDP rx dev_scratch (its charge was freed
Pls favor generic block comment style
/*
* skb->dev ...
> + * on dequeue above); a sockmap verdict program may deref it via
> + * bpf_sk_lookup_*(), so clear it -> bpf_skc_lookup() uses skb->sk
> + */
> + skb->dev = NULL;
> return recv_actor(sk, skb);
I'd put newlines before and after the added piece for readability.
WARN_ON_ONCE(...);
/*
* skb->dev ...
* ...
*/
skb->dev = NULL;
return recv_actor(sk, skb);
> }
Thanks,
Olek
next prev parent reply other threads:[~2026-06-03 13:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 12:26 Sechang Lim
2026-06-03 13:48 ` Alexander Lobakin [this message]
2026-06-03 16:21 ` [PATCH net v2] " Sechang Lim
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=423d23d2-b2ba-4a33-96f1-a1e21437484a@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=bpf@vger.kernel.org \
--cc=cong.wang@bytedance.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jakub@cloudflare.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rhkrqnwk98@gmail.com \
--cc=willemdebruijn.kernel@gmail.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®