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: oe-linux-nfc@lists.linux.dev, netdev@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: [PATCH net v2 0/2] nfc: rawsock: fix write-queue race and sk_destruct deadlock
Date: Fri, 04 Dec 2026 14:06:51 +0800	[thread overview]
Message-ID: <20261204060651.488-1-luob87709@gmail.com> (raw)

This series fixes two teardown issues in net/nfc/rawsock.c:

1. Patch 1/2 serializes SEND_SHUTDOWN updates/checks, sk_write_queue
   purging, and tx_work scheduling under sk->sk_write_queue.lock,
   closing the residual window left after commit d793458c45df ("nfc:
   rawsock: cancel tx_work before socket teardown") where an in-flight
   completion could re-queue tx_work during release, and guarding
   against NULL skb dereference in rawsock_tx_work().

2. Patch 2/2 moves nfc_deactivate_target() out of rawsock_destruct()
   into rawsock_release() (process context), preventing a 30-second
   self-deadlock on ndev->rx_wq when rawsock_data_exchange_complete()
   drops the final socket reference from nci_rx_work().

Changes in v2:
- Resend via b4 web relay (v1 had broken diff lines from Gmail wrapping)
  and send both dependent rawsock patches together as a threaded series.

Both patches were regression-tested in QEMU KVM with KASAN, LOCKDEP,
and DEBUG_OBJECTS enabled using virtual_ncidev across 3 x 200
iterations with zero timeouts or warnings, and passed
tools/testing/selftests/nci/nci_dev (8/8).

Bin Luo (University of Electronic Science and Technology of China) (2):
  nfc: rawsock: serialize SEND_SHUTDOWN and write queue teardown
  nfc: rawsock: move nfc_deactivate_target() to rawsock_release()

 net/nfc/rawsock.c | 54 +++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 35 insertions(+), 19 deletions(-)
-- 
2.43.0



             reply	other threads:[~2026-12-04  6:06 UTC|newest]

Thread overview: 3+ 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/2] nfc: rawsock: serialize SEND_SHUTDOWN and write queue teardown Bin Luo via B4 Relay
2026-12-04  6:06 ` [PATCH net v2 2/2] nfc: rawsock: move nfc_deactivate_target() to rawsock_release() 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=20261204060651.488-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 \
    /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