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