Netdev List
 help / color / mirror / Atom feed
* [PATCH net v6 0/6] nfc: fix NCI UART and firmware teardown races
@ 2026-10-21  3:24 Shubham Antil
  2026-10-21  3:24 ` [PATCH net v6 1/6] nfc: nci: skip controller reset while unregistering Shubham Antil
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Shubham Antil @ 2026-10-21  3:24 UTC (permalink / raw)
  To: netdev; +Cc: David Heidelberg, oe-linux-nfc, gio

This series fixes ordering and lifetime problems in NCI UART registration,
teardown, and nfcmrvl firmware download.

Patch 1 avoids issuing CORE_RESET after unregister has closed admission to
the NCI device.  A normal device-down still performs the reset.

Patches 2 and 3 serialize UART driver selection, protect the transport
registry, detach TTY callbacks first, and drain receive and transmit work
before the transport releases its private state.

Patch 4 publishes the Marvell UART state before NCI registration can expose
the device and rolls that publication back if registration fails.

Patches 5 and 6 serialize firmware-download ownership, copy completion
metadata before releasing it, and drain the Marvell receive and timeout
paths before unregistering the NCI device.

OpenAI Codex, gpt-5.6-sol assisted the source audit that found these
issues.  The UART paths were reproduced with a pty-backed NCI controller
under KASAN.  The firmware paths were exercised with overlapping download
requests and repeated download/teardown cycles.

---

Changes in v6:
- Skip CORE_RESET only while unregistering; retain it for normal
  device-down.
- Detach the line discipline before quiescing generic UART callbacks.
- Serialize concurrent NCIUARTSETDRIVER operations and the driver registry.
- Publish and withdraw Marvell UART state around NCI registration.
- Serialize generic firmware-download ownership and completion state.
- Drain Marvell firmware receive, timeout, and queue state before
  unregister.
- Add the requested discovery details, Fixes tags, and stable Cc tags.

v5: https://lore.kernel.org/netdev/20261013025746.41292-1-shubham@octane.security/
v4: https://lore.kernel.org/netdev/20261006115532.72100-1-shubham@octane.security/

Shubham Antil (6):
  nfc: nci: skip controller reset while unregistering
  nfc: nci: uart: serialize driver selection
  nfc: nci: uart: quiesce callbacks during teardown
  nfc: nfcmrvl: publish UART state before registration
  nfc: serialize firmware download state
  nfc: nfcmrvl: stop firmware work before unregistering

 drivers/nfc/nfcmrvl/fw_dnld.c    | 199 +++++++++++++++++++++++++----------
 drivers/nfc/nfcmrvl/fw_dnld.h    |   8 ++
 drivers/nfc/nfcmrvl/main.c       |  19 ++--
 drivers/nfc/nfcmrvl/nfcmrvl.h    |   2 +
 drivers/nfc/nfcmrvl/uart.c       |  31 ++++--
 drivers/nfc/st-nci/vendor_cmds.c |   8 +-
 include/net/nfc/nci_core.h       |   6 ++
 include/net/nfc/nfc.h            |   3 +-
 net/nfc/core.c                   |  19 +++-
 net/nfc/nci/core.c               |  12 ++-
 net/nfc/nci/uart.c               | 220 ++++++++++++++++++++++++++++++---------
 11 files changed, 398 insertions(+), 129 deletions(-)


base-commit: 1c1e8c24d537ba6133f08f523a2b8c626da4e966
-- 
2.43.0


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

end of thread, other threads:[~2026-10-21  3:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-21  3:24 [PATCH net v6 0/6] nfc: fix NCI UART and firmware teardown races Shubham Antil
2026-10-21  3:24 ` [PATCH net v6 1/6] nfc: nci: skip controller reset while unregistering Shubham Antil
2026-10-21  3:24 ` [PATCH net v6 2/6] nfc: nci: uart: serialize driver selection Shubham Antil
2026-10-21  3:24 ` [PATCH net v6 3/6] nfc: nci: uart: quiesce callbacks during teardown Shubham Antil
2026-10-21  3:24 ` [PATCH net v6 4/6] nfc: nfcmrvl: publish UART state before registration Shubham Antil
2026-10-21  3:24 ` [PATCH net v6 5/6] nfc: serialize firmware download state Shubham Antil
2026-10-21  3:24 ` [PATCH net v6 6/6] nfc: nfcmrvl: stop firmware work before unregistering Shubham Antil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox