Netdev List
 help / color / mirror / Atom feed
* [PATCH net v8 0/4] nfc: order NCI UART and firmware teardown
@ 2026-11-19  4:02 Shubham Antil
  2026-11-19  4:02 ` [PATCH net v8 1/4] nfc: nci: uart: serialize driver selection Shubham Antil
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Shubham Antil @ 2026-11-19  4:02 UTC (permalink / raw)
  To: netdev; +Cc: oe-linux-nfc, david, horms, gio

Make NCI UART driver selection, callback shutdown, close-time command
handling, and Marvell firmware completion explicit and ordered.

Patch 1 serializes NCIUARTSETDRIVER and protects the driver registry while
a transport takes its module reference.  Patch 2 rejects a second firmware
request without disturbing the active core state.  Patch 3 orders UART
publication and shutdown, preserves close-time reset and driver commands,
and bounds transport draining.  Patch 4 stops firmware timer, receive, and
command producers before their queues and private state are released.

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 final v8 code was tested with:

  - strict checkpatch and git diff checks for every patch;
  - targeted W=1 builds and current sparse checks;
  - full x86_64 bzImage and module builds with KASAN, UBSAN, lockdep, and
    DEBUG_LIST, and separately with strict-mode KCSAN;
  - 20 concurrent driver-selection cycles under each configuration;
  - 5 registration/publication and 5 reset-preserving lifecycle cycles
    under each configuration; and
  - 100 firmware teardown cycles and five timer-boundary modes under each
    configuration.

All test assertions completed with zero failures.  Neither sanitizer run
reported a memory, concurrency, locking, or undefined-behavior diagnostic.
Current sparse reported only two pre-existing warnings outside the changed
logic.  The st-nci close path was also built and checked separately because
it sends a final proprietary command from its close callback.

No in-tree selftest covers these NCI UART and nfcmrvl firmware paths.  No
physical Marvell controller was available for testing.

Changes since v7:

  - keep asynchronous core completion lockless to avoid an inverse lock
    order with driver-private locks;
  - serialize transmit wakeups and retain partial frames across worker
    restarts;
  - publish Marvell transport state before NCI registration while keeping
    receive admission closed until core queues are ready;
  - close command admission and drain response work before cancellation;
  - preserve the close-time reset and a driver's final close command, then
    cancel any command left by an interrupted synchronous request;
  - actively retry partial UART writes during the bounded close flush and
    poison a line-discipline instance whose framing cannot be preserved;
  - stop firmware receive, timeout, and command dependencies before core
    workqueue teardown; and
  - document lifecycle sleep, locking, lifetime, and queue-ownership
    contracts and refresh validation on the final tree.

v7: https://lore.kernel.org/netdev/20261104062026.80599-1-shubham@octane.security/

Shubham Antil (4):
  nfc: nci: uart: serialize driver selection
  nfc: reject overlapping firmware downloads
  nfc: nci: uart: quiesce callbacks during teardown
  nfc: nfcmrvl: stop firmware work before unregistering

 drivers/nfc/nfcmrvl/fw_dnld.c | 237 ++++++++++++-----
 drivers/nfc/nfcmrvl/fw_dnld.h |  11 +
 drivers/nfc/nfcmrvl/main.c    |  52 +++-
 drivers/nfc/nfcmrvl/nfcmrvl.h |   4 +
 drivers/nfc/nfcmrvl/uart.c    |  64 ++++-
 include/net/nfc/nci_core.h    |  29 +++
 net/nfc/core.c                |  20 +-
 net/nfc/nci/core.c            |  82 ++++--
 net/nfc/nci/rsp.c             |   3 +
 net/nfc/nci/uart.c            | 467 +++++++++++++++++++++++++++++-----
 10 files changed, 805 insertions(+), 164 deletions(-)


base-commit: 30c71476d842b094651bd7712f6c8ee8716147d0
-- 
2.54.0


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

end of thread, other threads:[~2026-11-19  4:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19  4:02 [PATCH net v8 0/4] nfc: order NCI UART and firmware teardown Shubham Antil
2026-11-19  4:02 ` [PATCH net v8 1/4] nfc: nci: uart: serialize driver selection Shubham Antil
2026-11-19  4:02 ` [PATCH net v8 2/4] nfc: reject overlapping firmware downloads Shubham Antil
2026-11-19  4:02 ` [PATCH net v8 3/4] nfc: nci: uart: quiesce callbacks during teardown Shubham Antil
2026-11-19  4:02 ` [PATCH net v8 4/4] 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