Netdev List
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@google.com>
To: xmei5@asu.edu
Cc: AutonomousCodeSecurity@microsoft.com, andrew+netdev@lunn.ch,
	 davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	kys@microsoft.com,  linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, pabeni@redhat.com,
	 tgopinath@linux.microsoft.com, tom@herbertland.com
Subject: Re: [PATCH net] vxlan: add missing NULL check for vxlan_sock in GRO path
Date: Mon,  6 Jul 2026 23:56:01 +0000	[thread overview]
Message-ID: <20260706235614.1726605-1-kuniyu@google.com> (raw)
In-Reply-To: <20260706233344.3334648-1-xmei5@asu.edu>

From: "Xiang Mei (Microsoft)" <xmei5@asu.edu>
Date: Mon,  6 Jul 2026 23:33:44 +0000
> vxlan_gro_prepare_receive() reads vs->flags from the vxlan_sock returned
> by rcu_dereference_sk_user_data(sk) without a NULL check, unlike the rest
> of the driver (e.g. vxlan_rcv() does "if (!vs) goto drop;").
> 
> udp_tunnel_sock_release() clears sk_user_data to NULL and waits an RCU
> grace period before the socket leaves the hash, so any callback running on
> the tunnel socket during teardown must tolerate a NULL sk_user_data. If a
> VXLAN device is torn down while GRO runs on its UDP tunnel socket,
> sk_user_data can be NULL when a packet carrying VXLAN_HF_RCO arrives,
> faulting in NAPI/softirq context.
> 
> The GRO path was the only sk_user_data reader on the socket missing this
> guard (vxlan_rcv and vxlan_err_lookup already have it; the gro_complete
> callbacks do not touch sk_user_data). Add the same NULL check so GRO
> flushes instead of dereferencing a NULL socket pointer.
> 
>   Oops: general protection fault ... SMP KASAN NOPTI
>   KASAN: probably user-memory-access in range [0x2018-0x201f]
>   RIP: 0010:vxlan_gro_prepare_receive (drivers/net/vxlan/vxlan_core.c:678)
>    vxlan_gro_receive (drivers/net/vxlan/vxlan_core.c:713)
>    udp_gro_receive (net/ipv4/udp_offload.c:841)
>    ...
>    dev_gro_receive (net/core/gro.c:522)
>    gro_receive_skb (net/core/gro.c:640)
>    tun_napi_poll (drivers/net/tun.c:259)
>    ...
>   Kernel panic - not syncing: Fatal exception in interrupt
> 
> Fixes: 5602c48cf875 ("vxlan: change vxlan to use UDP socket GRO")
> Reported-by: AutonomousCodeSecurity@microsoft.com
> Signed-off-by: Xiang Mei (Microsoft) <xmei5@asu.edu>
> ---
>  drivers/net/vxlan/vxlan_core.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
> index b5b1253ac08b..f2235bae9bfe 100644
> --- a/drivers/net/vxlan/vxlan_core.c
> +++ b/drivers/net/vxlan/vxlan_core.c
> @@ -663,6 +663,9 @@ static struct vxlanhdr *vxlan_gro_prepare_receive(struct sock *sk,
>  	struct vxlan_sock *vs = rcu_dereference_sk_user_data(sk);
>  	__be32 flags;
>  
> +	if (!vs)
> +		return NULL;

Please work on the latest tree, it's fixed 2 months ago.

commit 30a45c0bffdd62350261e2f2689fdba426a33578
Author: Kuniyuki Iwashima <kuniyu@google.com>
Date:   Sat May 2 03:12:59 2026

    vxlan: Fix potential null-ptr-deref in vxlan_gro_prepare_receive().

  reply	other threads:[~2026-07-06 23:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06 23:33 [PATCH net] vxlan: add missing NULL check for vxlan_sock in GRO path Xiang Mei (Microsoft)
2026-07-06 23:56 ` Kuniyuki Iwashima [this message]
2026-07-06 23:59   ` Xiang Mei

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=20260706235614.1726605-1-kuniyu@google.com \
    --to=kuniyu@google.com \
    --cc=AutonomousCodeSecurity@microsoft.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=tgopinath@linux.microsoft.com \
    --cc=tom@herbertland.com \
    --cc=xmei5@asu.edu \
    /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