[PATCH net v2 0/2] nfc: rawsock: fix write-queue race and sk_destruct deadlock
From: Bin Luo via B4 Relay
Date: Fri Dec 04 2026 - 01:07:18 EST
This series fixes two teardown issues in net/nfc/rawsock.c:
1. Patch 1/2 serializes SEND_SHUTDOWN updates/checks, sk_write_queue
purging, and tx_work scheduling under sk->sk_write_queue.lock,
closing the residual window left after commit d793458c45df ("nfc:
rawsock: cancel tx_work before socket teardown") where an in-flight
completion could re-queue tx_work during release, and guarding
against NULL skb dereference in rawsock_tx_work().
2. Patch 2/2 moves nfc_deactivate_target() out of rawsock_destruct()
into rawsock_release() (process context), preventing a 30-second
self-deadlock on ndev->rx_wq when rawsock_data_exchange_complete()
drops the final socket reference from nci_rx_work().
Changes in v2:
- Resend via b4 web relay (v1 had broken diff lines from Gmail wrapping)
and send both dependent rawsock patches together as a threaded series.
Both patches were regression-tested in QEMU KVM with KASAN, LOCKDEP,
and DEBUG_OBJECTS enabled using virtual_ncidev across 3 x 200
iterations with zero timeouts or warnings, and passed
tools/testing/selftests/nci/nci_dev (8/8).
Bin Luo (University of Electronic Science and Technology of China) (2):
nfc: rawsock: serialize SEND_SHUTDOWN and write queue teardown
nfc: rawsock: move nfc_deactivate_target() to rawsock_release()
net/nfc/rawsock.c | 54 +++++++++++++++++++++++++++++++++++-------------------
1 file changed, 35 insertions(+), 19 deletions(-)
--
2.43.0