All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2 0/3] nfc: fix LLCP, nfcsim, and digital device teardown ordering
@ 2026-12-04  6:06 ` Bin Luo via B4 Relay
  0 siblings, 0 replies; 11+ messages in thread
From: Bin Luo (University of Electronic Science and Technology of China) @ 2026-12-04  6:06 UTC (permalink / raw)
  To: David Heidelberg, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman
  Cc: Krzysztof Kozlowski, oe-linux-nfc, netdev, linux-kernel

This series fixes three teardown ordering issues across LLCP, nfcsim,
and the NFC Digital stack:

1. Patch 1/3 fixes local_cleanup() in net/nfc/llcp_core.c so work items
   and timers are shut down in producer-to-consumer order using
   disable_work_sync() and timer_shutdown_sync(), and purges tx_queue
   after tx_work is disabled so an skb put back via skb_queue_head() is
   not leaked.

2. Patch 2/3 completes commit 5e7b30d24a5b ("nfc: nfcsim: fix use after
   free during module unload") by marking dev->up = false, shutting
   down link_in, and disabling send_work/recv_work before calling
   nfc_digital_unregister_device(), fixing a KASAN slab-use-after-free
   write in digital_send_cmd_complete() triggered during nfcsim unload.

3. Patch 3/3 aligns nfc_digital_unregister_device() with
   nci_unregister_device() by calling nfc_unregister_rfkill() first,
   disabling poll_work/cmd_work/cmd_complete_work, draining cmd_queue
   while struct nfc_llcp_local is still registered, and calling
   nfc_remove_device() last.

Changes in v2:
- Resend via b4 web relay (v1 had broken diff lines from Gmail wrapping)
  and send all three teardown fixes together as a threaded series.

Tested in QEMU KVM (KASAN, LOCKDEP, DEBUG_OBJECTS_TIMERS,
DEBUG_OBJECTS_WORK) across 200 nfcsim load/unload cycles with 32
concurrent raw LLCP sockets and active LLCP traffic, and passed
tools/testing/selftests/nci/nci_dev (8/8).

Bin Luo (University of Electronic Science and Technology of China) (3):
  nfc: llcp: fix work and timer teardown order in local_cleanup()
  nfc: nfcsim: stop link and works before unregistering digital device
  nfc: digital: stop works and drain commands before nfc_remove_device()

 drivers/nfc/nfcsim.c   |  8 ++++----
 net/nfc/digital_core.c | 10 ++++++----
 net/nfc/llcp_core.c    | 12 ++++++------
 3 files changed, 16 insertions(+), 14 deletions(-)
-- 
2.43.0


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

end of thread, other threads:[~2026-12-05  6:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04  6:06 [PATCH net v2 0/3] nfc: fix LLCP, nfcsim, and digital device teardown ordering Bin Luo (University of Electronic Science and Technology of China)
2026-12-04  6:06 ` Bin Luo via B4 Relay
2026-12-04  6:06 ` [PATCH net v2 1/3] nfc: llcp: fix work and timer teardown order in local_cleanup() Bin Luo via B4 Relay
2026-12-04  6:06   ` Bin Luo (University of Electronic Science and Technology of China)
2026-12-05  6:57   ` netdev-bot+sashiko
2026-12-04  6:06 ` [PATCH net v2 2/3] nfc: nfcsim: stop link and works before unregistering digital device Bin Luo via B4 Relay
2026-12-04  6:06   ` Bin Luo (University of Electronic Science and Technology of China)
2026-12-05  6:57   ` netdev-bot+sashiko
2026-12-04  6:06 ` [PATCH net v2 3/3] nfc: digital: stop works and drain commands before nfc_remove_device() Bin Luo via B4 Relay
2026-12-04  6:06   ` Bin Luo (University of Electronic Science and Technology of China)
2026-12-05  6:57   ` netdev-bot+sashiko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.