mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: "Cen Zhang (Microsoft)" <blbllhy@gmail.com>
Cc: laforge@gnumonks.org, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, anthony.l.nguyen@intel.com,
	wojciech.drewek@intel.com, osmocom-net-gprs@lists.osmocom.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	AutonomousCodeSecurity@microsoft.com, xmei5@asu.edu,
	tgopinath@linux.microsoft.com, kys@microsoft.com
Subject: Re: [PATCH net v2 0/2] gtp: fix sk_created race conditions
Date: Wed, 26 Aug 2026 14:20:21 +0200	[thread overview]
Message-ID: <ao7aBWwaGNCwnEQv@chamomile> (raw)
In-Reply-To: <20260825052404.45665-1-blbllhy@gmail.com>

On Tue, Aug 25, 2026 at 01:24:02AM -0400, Cen Zhang (Microsoft) wrote:
> Two races exist around the sk_created flag in the GTP driver: an
> initialization ordering issue where sk_created is published before the
> socket pointers are assigned, and a teardown lifetime issue where
> concurrent readers can still use the sockets after they are freed. They
> are split into separate patches because they require fundamentally
> different fixes -- memory barriers for ordering vs synchronize_net() and
> RTNL for lifetime.

May I suggest to partial revert of these patches?

 d33bd757d362 ("gtp: Implement GTP echo request")
 9af41cc33471 ("gtp: Implement GTP echo response")

I don't see a use-case for them

I can see a use-case for:

b20dc3c68458 ("gtp: Allow to create GTP device without FDs")

for testing purpose, ie. allowing to create a GTP tunnel without a
userspace program which deals with control plane.

As far as I understood, the reported issues are all related to them.

> Changes since v1 [1]:
> - Use smp_store_release()/smp_load_acquire() for proper memory ordering
>   as suggested by Simon Horman.
> - Add patch 2/2 to fix teardown races in gtp_encap_disable(): reorder
>   to clear sk_created first, add synchronize_net() for softirq paths,
>   and hold RTNL in gtp_genl_send_echo_req() for the process-context
>   path that synchronize_net() cannot protect.
> 
> Patch 1/2 fixes the initialization ordering race.
> Patch 2/2 fixes the teardown lifetime races (softirq + genl).
> 
> [1] https://lore.kernel.org/netdev/20260816035205.57966-1-blbllhy@gmail.com/
> 
> Cen Zhang (Microsoft) (2):
>   gtp: fix sk_created publication race in gtp_create_sockets()
>   gtp: fix use-after-free during GTP device teardown
> 
>  drivers/net/gtp.c | 70 ++++++++++++++++++++++++++++++++++-------------
>  1 file changed, 51 insertions(+), 19 deletions(-)
> 
> 
> base-commit: b70b7b71561f2be1183b6046964d950c2b203bfc
> -- 
> 2.55.0

      parent reply	other threads:[~2026-08-26 12:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25  5:24 Cen Zhang (Microsoft)
2026-08-25  5:24 ` [PATCH net v2 1/2] gtp: fix sk_created publication race in gtp_create_sockets() Cen Zhang (Microsoft)
2026-08-25  5:24 ` [PATCH net v2 2/2] gtp: fix use-after-free during GTP device teardown Cen Zhang (Microsoft)
2026-08-26 12:20 ` Pablo Neira Ayuso [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=ao7aBWwaGNCwnEQv@chamomile \
    --to=pablo@netfilter.org \
    --cc=AutonomousCodeSecurity@microsoft.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=blbllhy@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kys@microsoft.com \
    --cc=laforge@gnumonks.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=osmocom-net-gprs@lists.osmocom.org \
    --cc=pabeni@redhat.com \
    --cc=tgopinath@linux.microsoft.com \
    --cc=wojciech.drewek@intel.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

all inboxes | Powered by JetHome®