mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH ipsec 0/4] xfrm: Fix device state teardown races
@ 2026-11-25  1:34 Jianbo Liu
  2026-11-25  1:34 ` [PATCH ipsec 1/4] xfrm: Give GC list nodes their own storage Jianbo Liu
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jianbo Liu @ 2026-11-25  1:34 UTC (permalink / raw)
  To: netdev, ipsec
  Cc: Steffen Klassert, Herbert Xu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Florian Westphal,
	linux-kernel, Jianbo Liu

Three fixes for the teardown of xfrm device offload state and one
revert, for ipsec.

xfrm_dev_state_free() runs for the same state from the state GC, from
the device flush and from xfrm_state_find(). Commit 89fefad9f971
("xfrm: serialize state GC with device state flush") serializes the
first two with a mutex, but xfrm_state_find() runs under RCU and
still races with the flush.

Let only one caller free the device state of an SA, hold a state
reference in the flush and wait for an RCU grace period before the
free. The mutex is not needed after that, so revert that commit.

1. xfrm: Give GC list nodes their own storage
   Stop sharing the GC list nodes with the bydst and bysrc hash nodes.
   Patch 2 uses gclist on states that RCU readers may still walk.

2. xfrm: Serialize device state teardown
   Let only one caller free the device state of an SA.

3. xfrm: Wait for an RCU grace period before freeing device state
   Let RCU readers of the driver state finish before the free.

4. Revert "xfrm: serialize state GC with device state flush"
   Remove the mutex that the fixes above make redundant.

Jianbo Liu (4):
  xfrm: Give GC list nodes their own storage
  xfrm: Serialize device state teardown
  xfrm: Wait for an RCU grace period before freeing device state
  Revert "xfrm: serialize state GC with device state flush"

 include/net/xfrm.h     | 10 +++----
 net/xfrm/xfrm_device.c |  4 +--
 net/xfrm/xfrm_state.c  | 61 ++++++++++++++++++++++++++----------------
 3 files changed, 44 insertions(+), 31 deletions(-)


base-commit: b88c75488ecc768acadb14e980bbfa087b1dbf38
-- 
2.39.3


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-25  1:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25  1:34 [PATCH ipsec 0/4] xfrm: Fix device state teardown races Jianbo Liu
2026-11-25  1:34 ` [PATCH ipsec 1/4] xfrm: Give GC list nodes their own storage Jianbo Liu
2026-11-25  1:34 ` [PATCH ipsec 2/4] xfrm: Serialize device state teardown Jianbo Liu
2026-11-25  1:34 ` [PATCH ipsec 3/4] xfrm: Wait for an RCU grace period before freeing device state Jianbo Liu
2026-11-25  1:34 ` [PATCH ipsec 4/4] Revert "xfrm: serialize state GC with device state flush" Jianbo Liu

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®