Netdev List
 help / color / mirror / Atom feed
From: Shubham Antil <shubham@octane.security>
To: netdev@vger.kernel.org
Cc: oe-linux-nfc@lists.linux.dev, david@ixit.cz, horms@kernel.org,
	gio@octane.security
Subject: [PATCH net v8 0/4] nfc: order NCI UART and firmware teardown
Date: Thu, 19 Nov 2026 09:32:49 +0530	[thread overview]
Message-ID: <20261119040253.15986-1-shubham@octane.security> (raw)

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


             reply	other threads:[~2026-11-19  4:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  4:02 Shubham Antil [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261119040253.15986-1-shubham@octane.security \
    --to=shubham@octane.security \
    --cc=david@ixit.cz \
    --cc=gio@octane.security \
    --cc=horms@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oe-linux-nfc@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox