Make NCI UART driver selection, callback shutdown, and Marvell firmware
download completion explicit and ordered.
Patch 1 serializes NCIUARTSETDRIVER and protects the driver registry while
a transport takes its module reference. Patch 2 closes UART callback
admission before private state is released, publishes the Marvell transport
state before registration, and preserves the unregister-time CORE_RESET
before quiescing and halting the controller. Patch 3 drains the Marvell
firmware timer/work/command dependencies before NCI workqueues are
destroyed and prevents a new download from replacing state which is still
active or completing.
The firmware overlap guard is local to nfcmrvl. It does not change the
completion rules of other NFC drivers.
Source auditing, patch development, review triage, and test planning were
assisted by OpenAI Codex, gpt-5.6-sol. I reviewed and tested the resulting
changes and take responsibility for them under my Signed-off-by.
The series was tested from the stated net tree base with:
- strict checkpatch and git diff checks for every patch;
- targeted W=1 builds and sparse checks;
- a W=1 allmodconfig build;
- an allyesconfig W=1 compile through vmlinux.o; the final global
objtool pass could not be completed on the 8 GiB test host because its
working set required heavy disk-backed paging, while the affected NFC
objects compiled without warnings;
- a full x86_64 bzImage and module build;
- KASAN, UBSAN, lockdep, and DEBUG_LIST enabled while exercising a
pty-backed user-space controller through reset-preserving lifecycle,
concurrent driver selection, registration/publication, overlapping
firmware requests, and firmware teardown cycles;
- a separate strict-mode KCSAN run over the same lifecycle and race
surfaces.
No in-tree selftest covers these NCI UART and nfcmrvl firmware paths. No
physical Marvell controller was available for testing.
---
Changes in v7:
- drop the generic NCI unregister/reset and firmware-serialization changes
and keep both fixes local to the affected transport;
- retain the close-time CORE_RESET and halt the controller only after
unregistering;
- fold Marvell state publication into the UART teardown change so each
patch remains usable on its own;
- restart a queued frame when the transport publishes READY and balance
tx_start() with tx_done() when teardown catches an active burst;
- replace generic firmware serialization with an nfcmrvl-local
active/completing gate;
- drain both directions of the NCI command timer/work dependency and purge
commands which can no longer run;
- hold firmware frames until the reset pulse finishes, queue timeout
completion on the firmware workqueue, and preserve positive errno
reporting;
- drop the stable Cc because each patch exceeds the current stable-tree
size limit and would require separate stable handling after review;
- document the discovery, validation, test environment, tool assistance,
and selftest and hardware coverage required by current netdev rules.
v6: https://lore.kernel.org/netdev/20261021032443.44412-1-shubham@octane.security/ (local)
Shubham Antil (3):
nfc: nci: uart: serialize driver selection
nfc: nci: uart: quiesce callbacks during teardown
nfc: nfcmrvl: stop firmware work before unregistering
drivers/nfc/nfcmrvl/fw_dnld.c | 243 +++++++++++++++++++++++++---------
drivers/nfc/nfcmrvl/fw_dnld.h | 11 ++
drivers/nfc/nfcmrvl/main.c | 18 ++-
drivers/nfc/nfcmrvl/nfcmrvl.h | 2 +
drivers/nfc/nfcmrvl/uart.c | 28 +++-
include/net/nfc/nci_core.h | 6 +
net/nfc/nci/uart.c | 235 +++++++++++++++++++++++++-------
7 files changed, 419 insertions(+), 124 deletions(-)
base-commit: 21f57ec673a1917547c808cfa81890485fffa03b
--
2.54.0