mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net v3 0/2] nfc: rawsock: fix teardown races and destruct-time deactivation deadlock
@ 2026-12-06 10:52 Bin Luo via B4 Relay
  2026-12-06 10:52 ` [PATCH net v3 1/2] nfc: rawsock: serialize SEND_SHUTDOWN and write queue teardown Bin Luo via B4 Relay
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Bin Luo via B4 Relay @ 2026-12-06 10:52 UTC (permalink / raw)
  To: David Heidelberg, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman
  Cc: oe-linux-nfc, netdev, linux-kernel, stable

This 2-patch series fixes socket teardown races and a 30-second
ndev->rx_wq self-deadlock in net/nfc/rawsock.c:

1. Patch 1 serializes SEND_SHUTDOWN updates/checks, write-queue purging,
   and tx_work scheduling under sk->sk_write_queue.lock, and ensures
   sk->sk_err is written before purging so woken writers observe the NFC
   error rather than -EPIPE.
2. Patch 2 removes synchronous nfc_deactivate_target() from
   rawsock_destruct() (which deadlocks when called from ndev->rx_wq) and
   tracks tx_in_flight under sk_write_queue.lock so close() deactivates
   synchronously when idle or defers deactivation to a dedicated unbound
   rawsock_wq work item once the in-flight data exchange completes,
   preventing any race with driver completion handlers (e.g. pn533
   resp_q).

Changes in v3:
- Address all Sashiko AI review comments: defer deactivation until after
  in-flight driver completion finishes (Critical), set sk->sk_err via
  WRITE_ONCE() prior to write-queue purge (Medium), fix race 2 commit
  description and Fixes tag to 23b7869c0fd0 (Low), and normalize
  From:/Signed-off-by: author metadata (Low).

Bin Luo (2):
  nfc: rawsock: serialize SEND_SHUTDOWN and write queue teardown
  nfc: rawsock: avoid synchronous target deactivation in
    rawsock_destruct()

 net/nfc/nfc.h     |   3 ++
 net/nfc/rawsock.c | 115 ++++++++++++++++++++++++++++++++++++----------
 2 files changed, 95 insertions(+), 23 deletions(-)

-- 
2.43.0




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

end of thread, other threads:[~2026-12-06 11:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-06 10:52 [PATCH net v3 0/2] nfc: rawsock: fix teardown races and destruct-time deactivation deadlock Bin Luo via B4 Relay
2026-12-06 10:52 ` [PATCH net v3 1/2] nfc: rawsock: serialize SEND_SHUTDOWN and write queue teardown Bin Luo via B4 Relay
2026-12-06 10:52 ` [PATCH net v3 2/2] nfc: rawsock: avoid synchronous target deactivation in rawsock_destruct() Bin Luo via B4 Relay
2026-12-06 10:57 ` [PATCH net v3 0/2] nfc: rawsock: fix teardown races and destruct-time deactivation deadlock netdev-bot+sinfo
2026-12-06 11:04   ` bin luo

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®