The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Cen Zhang (Microsoft)" <blbllhy@gmail.com>
To: pablo@netfilter.org, laforge@gnumonks.org, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com
Cc: 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,
	blbllhy@gmail.com
Subject: [PATCH net v2 0/2] gtp: fix sk_created race conditions
Date: Tue, 25 Aug 2026 01:24:02 -0400	[thread overview]
Message-ID: <20260825052404.45665-1-blbllhy@gmail.com> (raw)

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.

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

             reply	other threads:[~2026-08-25  5:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25  5:24 Cen Zhang (Microsoft) [this message]
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)

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=20260825052404.45665-1-blbllhy@gmail.com \
    --to=blbllhy@gmail.com \
    --cc=AutonomousCodeSecurity@microsoft.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.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=pablo@netfilter.org \
    --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