nfc: nci: uart: quiesce write_work during teardown
Get series with b4
b4 am [email protected]Versions newest first
- v5 Latest2 patches 0 repliesNew
Changes in v5 from the cover letter
- Preserve the unregister-time CORE_RESET transmit attempt by closing the transport before starting the generic worker barrier.
- Quiesce the Marvell worker after NCI unregister and before private-state release.
- Serialize the worker's final state handoff to prevent a lost wakeup.
- Correct the tty write-wakeup race description and close-contract comment.
- Take the module reference before ops.open() and drain work on open failure.
- Publish and roll back Marvell UART state through transport callbacks.
- Add the LLM-assisted audit and KASAN discovery details.
- Keep unrelated concurrency follow-ups outside this series.
Patches in v5 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | nfc: nfcmrvl: publish UART state before registrationdrivers/ drivers/ drivers/ | +29 | 0 replies | |
| 2/2 | nfc: nci: uart: quiesce write_work during teardowndrivers/ drivers/ drivers/ +2 more | +91 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.
Cover letter [PATCH net v5 0/2] nfc: nci: uart: quiesce write_work during teardown
This series fixes the NCI UART write-worker teardown ordering without blocking the controller reset which nci_unregister_device() may transmit during teardown. It also fixes the Marvell UART state-publication race reproduced while exercising that path.
Patch 1 publishes the Marvell UART back-pointers before NCI device registration can expose the device, rolls them back on registration failure, and establishes the controller's initial halt state before registration.
Patch 2 serializes producers with the write worker's final state handoff. The generic close invokes the transport close first, allowing the unregister CORE_RESET transmit attempt, then blocks new work and cancels the worker before freeing the skbs. Marvell performs that barrier after NCI unregister but before it releases private state. The failed-open path uses the same barrier, and the transport module is held while its open callback runs.
The tty write-wakeup description has been corrected: a wakeup may queue or run immediately before close; it does not run inside the close callback. The same spinlock now protects producer scheduling and the worker's final SENDING/WAKEUP transition, closing the reported lost-wakeup window.
Both ordering issues were found during an LLM-assisted source audit and reproduced using a pty-backed NCI UART under KASAN. With these patches, a 61-cycle regression run and a 56,690-cycle registration/hangup stress run completed without sanitizer reports.
Other concurrency concerns raised during review are outside the scope of this teardown series and will be handled separately.
---
Changes in v5:
- Preserve the unregister-time CORE_RESET transmit attempt by closing the transport before starting the generic worker barrier.
- Quiesce the Marvell worker after NCI unregister and before private-state release.
- Serialize the worker's final state handoff to prevent a lost wakeup.
- Correct the tty write-wakeup race description and close-contract comment.
- Take the module reference before ops.open() and drain work on open failure.
- Publish and roll back Marvell UART state through transport callbacks.
- Add the LLM-assisted audit and KASAN discovery details.
- Keep unrelated concurrency follow-ups outside this series.
v4: https://lore.kernel.org/netdev/[email protected]/
v3: https://lore.kernel.org/netdev/[email protected]/
Shubham Antil (2):
nfc: nfcmrvl: publish UART state before registration
nfc: nci: uart: quiesce write_work during teardown
drivers/nfc/nfcmrvl/main.c | 18 +++++-- drivers/nfc/nfcmrvl/nfcmrvl.h | 3 ++ drivers/nfc/nfcmrvl/uart.c | 32 +++++++++++-- include/net/nfc/nci_core.h | 3 ++ net/nfc/nci/uart.c | 90 ++++++++++++++++++++++++++++------- 5 files changed, 120 insertions(+), 26 deletions(-)
base-commit: 72d3fcf802c45d00b300f25b848a93c3a2bd7c7e
Signature · 1 line
2.43.0