The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Bin Luo via B4 Relay <devnull+luob87709.gmail.com@kernel.org>
To: David Heidelberg <david@ixit.cz>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,  Simon Horman <horms@kernel.org>
Cc: Krzysztof Kozlowski <krzk@kernel.org>,
	oe-linux-nfc@lists.linux.dev,  netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,  stable@vger.kernel.org
Subject: [PATCH net v3 0/3] nfc: fix LLCP, nfcsim, and digital teardown ordering races
Date: Sun, 06 Dec 2026 10:52:15 -0000	[thread overview]
Message-ID: <20261206105215.479-1-luob87709@gmail.com> (raw)

This 3-patch series fixes teardown ordering use-after-free and
work/timer re-arming bugs across NFC LLCP, nfcsim, and the NFC Digital
core:

1. Patch 1 reorders local_cleanup() in net/nfc/llcp_core.c using
   disable_work_sync() and timer_shutdown_sync() in producer-to-consumer
   order and purges tx_queue after tx_work is disabled.
2. Patch 2 stops link_in and permanently disables send_work/recv_work in
   nfcsim_device_free() before nfc_digital_unregister_device() drains
   ddev->cmd_queue, keeps dev->up = false after unregister so in-flight
   commands are not silently dropped without cmd_cb(), and wakes
   nfcsim_link_recv_skb() on link->shutdown to prevent teardown stalls.
3. Patch 3 reorders nfc_digital_unregister_device() to stop works and
   drain cmd_queue (freeing orphaned cmd->req/cmd->resp skbs) before
   nfc_remove_device() tears down LLCP.

Changes in v3:
- Address all Sashiko AI review comments: keep dev->up = false after
  nfc_digital_unregister_device() and wake nfcsim_link_recv_skb() on
  link->shutdown (Patch 2 Medium x2), free orphaned cmd->req and
  cmd->resp skbs in the digital drain loop (Patch 3 Medium), fix Fixes
  tags and commit descriptions (Low), and normalize From:/Signed-off-by:
  author metadata (Low).

Bin Luo (3):
  nfc: llcp: fix work and timer teardown order in local_cleanup()
  nfc: nfcsim: stop link and works before unregistering digital device
  nfc: digital: stop works and drain commands before nfc_remove_device()

 drivers/nfc/nfcsim.c   | 23 ++++++++++++-----------
 net/nfc/digital_core.c | 15 +++++++++++----
 net/nfc/llcp_core.c    | 12 ++++++------
 3 files changed, 29 insertions(+), 21 deletions(-)

-- 
2.43.0




             reply	other threads:[~2026-12-06 10:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-06 10:52 Bin Luo via B4 Relay [this message]
2026-12-06 10:52 ` [PATCH net v3 3/3] nfc: digital: stop works and drain commands before nfc_remove_device() Bin Luo via B4 Relay
2026-12-06 10:52 ` [PATCH net v3 1/3] nfc: llcp: fix work and timer teardown order in local_cleanup() Bin Luo via B4 Relay
2026-12-06 10:52 ` [PATCH net v3 2/3] nfc: nfcsim: stop link and works before unregistering digital device Bin Luo via B4 Relay
2026-12-06 10:57 ` [PATCH net v3 0/3] nfc: fix LLCP, nfcsim, and digital teardown ordering races netdev-bot+sinfo
2026-12-06 11:04   ` bin luo

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=20261206105215.479-1-luob87709@gmail.com \
    --to=devnull+luob87709.gmail.com@kernel.org \
    --cc=davem@davemloft.net \
    --cc=david@ixit.cz \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=krzk@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luob87709@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=oe-linux-nfc@lists.linux.dev \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    /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