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
Subject: [PATCH net v2 0/3] nfc: fix LLCP, nfcsim, and digital device teardown ordering
Date: Fri, 04 Dec 2026 14:06:56 +0800 [thread overview]
Message-ID: <20261204060656.503-1-luob87709@gmail.com> (raw)
This series fixes three teardown ordering issues across LLCP, nfcsim,
and the NFC Digital stack:
1. Patch 1/3 fixes local_cleanup() in net/nfc/llcp_core.c so work items
and timers are shut down in producer-to-consumer order using
disable_work_sync() and timer_shutdown_sync(), and purges tx_queue
after tx_work is disabled so an skb put back via skb_queue_head() is
not leaked.
2. Patch 2/3 completes commit 5e7b30d24a5b ("nfc: nfcsim: fix use after
free during module unload") by marking dev->up = false, shutting
down link_in, and disabling send_work/recv_work before calling
nfc_digital_unregister_device(), fixing a KASAN slab-use-after-free
write in digital_send_cmd_complete() triggered during nfcsim unload.
3. Patch 3/3 aligns nfc_digital_unregister_device() with
nci_unregister_device() by calling nfc_unregister_rfkill() first,
disabling poll_work/cmd_work/cmd_complete_work, draining cmd_queue
while struct nfc_llcp_local is still registered, and calling
nfc_remove_device() last.
Changes in v2:
- Resend via b4 web relay (v1 had broken diff lines from Gmail wrapping)
and send all three teardown fixes together as a threaded series.
Tested in QEMU KVM (KASAN, LOCKDEP, DEBUG_OBJECTS_TIMERS,
DEBUG_OBJECTS_WORK) across 200 nfcsim load/unload cycles with 32
concurrent raw LLCP sockets and active LLCP traffic, and passed
tools/testing/selftests/nci/nci_dev (8/8).
Bin Luo (University of Electronic Science and Technology of China) (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 | 8 ++++----
net/nfc/digital_core.c | 10 ++++++----
net/nfc/llcp_core.c | 12 ++++++------
3 files changed, 16 insertions(+), 14 deletions(-)
--
2.43.0
next reply other threads:[~2026-12-04 6:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 6:06 Bin Luo via B4 Relay [this message]
2026-12-04 6:06 ` [PATCH net v2 1/3] nfc: llcp: fix work and timer teardown order in local_cleanup() Bin Luo via B4 Relay
2026-12-04 6:06 ` [PATCH net v2 2/3] nfc: nfcsim: stop link and works before unregistering digital device Bin Luo via B4 Relay
2026-12-04 6:06 ` [PATCH net v2 3/3] nfc: digital: stop works and drain commands before nfc_remove_device() Bin Luo via B4 Relay
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=20261204060656.503-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 \
/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