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: oe-linux-nfc@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: [PATCH net v3 0/2] nfc: rawsock: fix teardown races and destruct-time deactivation deadlock
Date: Sun, 06 Dec 2026 10:52:11 -0000 [thread overview]
Message-ID: <20261206105211.379-1-luob87709@gmail.com> (raw)
This 2-patch series fixes socket teardown races and a 30-second
ndev->rx_wq self-deadlock in net/nfc/rawsock.c:
1. Patch 1 serializes SEND_SHUTDOWN updates/checks, write-queue purging,
and tx_work scheduling under sk->sk_write_queue.lock, and ensures
sk->sk_err is written before purging so woken writers observe the NFC
error rather than -EPIPE.
2. Patch 2 removes synchronous nfc_deactivate_target() from
rawsock_destruct() (which deadlocks when called from ndev->rx_wq) and
tracks tx_in_flight under sk_write_queue.lock so close() deactivates
synchronously when idle or defers deactivation to a dedicated unbound
rawsock_wq work item once the in-flight data exchange completes,
preventing any race with driver completion handlers (e.g. pn533
resp_q).
Changes in v3:
- Address all Sashiko AI review comments: defer deactivation until after
in-flight driver completion finishes (Critical), set sk->sk_err via
WRITE_ONCE() prior to write-queue purge (Medium), fix race 2 commit
description and Fixes tag to 23b7869c0fd0 (Low), and normalize
From:/Signed-off-by: author metadata (Low).
Bin Luo (2):
nfc: rawsock: serialize SEND_SHUTDOWN and write queue teardown
nfc: rawsock: avoid synchronous target deactivation in
rawsock_destruct()
net/nfc/nfc.h | 3 ++
net/nfc/rawsock.c | 115 ++++++++++++++++++++++++++++++++++++----------
2 files changed, 95 insertions(+), 23 deletions(-)
--
2.43.0
next reply other threads:[~2026-12-06 10:52 UTC|newest]
Thread overview: 5+ 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 2/2] nfc: rawsock: avoid synchronous target deactivation in rawsock_destruct() Bin Luo via B4 Relay
2026-12-06 10:52 ` [PATCH net v3 1/2] nfc: rawsock: serialize SEND_SHUTDOWN and write queue teardown Bin Luo via B4 Relay
2026-12-06 10:57 ` [PATCH net v3 0/2] nfc: rawsock: fix teardown races and destruct-time deactivation deadlock 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=20261206105211.379-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=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