From: "Bin Luo (University of Electronic Science and Technology of China)" <luob87709@gmail.com>
To: oe-linux-nfc@lists.linux.dev
Cc: johan@kernel.org, david@ixit.cz, kuba@kernel.org, netdev@vger.kernel.org
Subject: [PATCH v5 0/5] net/nfc: fix skb ownership, reassembly cleanup, and NCI status errors
Date: Fri, 27 Nov 2026 21:40:24 +0800 [thread overview]
Message-ID: <20261127134029.1813-1-luob87709@gmail.com> (raw)
Hi,
This v5 series addresses all four findings from the Sashiko AI review on
v4 and includes the discovery method requested by netdev-bot+sinfo:
Changes in v5:
- Split the former v4 Patch 1/2 into four single-purpose patches with
accurate problem descriptions and complete Fixes: tags covering each
affected driver/layer:
- 1/5: Document the data_exchange_cb_t ownership contract and fix
callback skb leaks across rawsock, LLCP, HCI/NCI-HCI, Microread,
PN544, and ST21NFCA (explicitly covering ST21NFCA DEP success-path
leaks on READER_F, r < 0, and unknown PFB types), synchronize
HCI/NCI-HCI rx_hcp_frags with a local splice, and accurately
describe the nci_nfcc_loopback_cb() NULL-dereference / !conn_info
leak (noting the current mainline NCI_DATA_EXCHANGE gating nuance).
- 2/5: Fix double-free of resp after queueing to dev->resp_q in PN533
(both pn533_data_exchange_complete() and
pn533_tm_get_data_complete()).
- 3/5: Fix missing completion callbacks on terminal errors in Digital
DEP (preventing hangs and socket refcount leaks).
- 4/5: Drop stale ndev->rx_data_reassembly on NCI data-status errors,
unconditionally on CORE_INTERFACE_ERROR_NTF (outside the
NCI_DATA_EXCHANGE check, covering listen/target mode), on
data-exchange timeouts, and in nci_close_device() after
flush_workqueue(ndev->rx_wq) on both close paths (guarded by
req_lock and !NCI_UP).
- 5/5: Preserve signed errno codes in nci_add_rx_data_frag() (former
v4 Patch 2/2).
- Document the discovery method in every commit message (static
call-chain audit and code inspection, with QEMU KASAN+kmemleak
reproduction for the NCI status truncation and rawsock leak).
Validation:
- All 5 patches apply cleanly on v7.4-rc5 (4dce97c6c265) and pass
full-tree scripts/checkpatch.pl --strict (0 errors, 0 checks; the
only 2 warnings in 1/5 are checkpatch codespell false positives on
the verbatim upstream commit subject of Fixes: 97f18414af39).
- W=1 compilation of all 13 modified NFC object files (rawsock,
llcp_core, digital_dep, hci/core, nci/{core,data,hci,ntf}, pn533,
pn544, microread, st21nfca/{core,dep}) passed with 0 warnings and
0 errors.
- Full x86_64 KASAN + kmemleak bzImage build and real QEMU TCG
verification (32 NCI 1.0 MIFARE status-error 0x01 exchanges as
euid 65534 over virtual_ncidev): all 32 iterations reported
SO_ERROR_OBSERVED=16 (expected=16) with SELFTEST_STATUS=0, 0 KASAN
reports, and 0 kmemleak unreferenced objects.
- Real PN533/PN544/Microread/ST21NFCA hardware was not exercised.
Best regards,
Bin Luo
Bin Luo (University of Electronic Science and Technology of China) (5):
net/nfc: fix skb ownership on data exchange errors
nfc: pn533: clear resp after queueing to avoid double free
nfc: digital: complete DEP data exchange on terminal errors
nfc: nci: drop stale rx_data_reassembly on errors, timeout, and close
nfc: preserve NCI data status error codes
drivers/nfc/microread/microread.c | 3 +--
drivers/nfc/pn533/pn533.c | 2 ++
drivers/nfc/pn544/pn544.c | 3 +--
drivers/nfc/st21nfca/core.c | 3 +--
drivers/nfc/st21nfca/dep.c | 26 ++++++++++++-------------
include/net/nfc/nfc.h | 5 ++++-
net/nfc/digital_dep.c | 32 ++++++++++++++-----------------
net/nfc/hci/core.c | 25 +++++++++++++++++-------
net/nfc/llcp_core.c | 4 +++-
net/nfc/nci/core.c | 25 ++++++++++++++++++++++--
net/nfc/nci/data.c | 8 ++++----
net/nfc/nci/hci.c | 23 +++++++++++++++++-----
net/nfc/nci/ntf.c | 4 ++++
net/nfc/rawsock.c | 5 ++++-
14 files changed, 110 insertions(+), 58 deletions(-)
base-commit: 4dce97c6c265544342e716e62fd24bbb232590c5
--
2.51.0.windows.1
next reply other threads:[~2026-11-27 13:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 13:40 Bin Luo (University of Electronic Science and Technology of China) [this message]
2026-11-27 13:40 ` [PATCH v5 1/5] net/nfc: fix skb ownership on data exchange errors Bin Luo (University of Electronic Science and Technology of China)
2026-11-27 13:40 ` [PATCH v5 2/5] nfc: pn533: clear resp after queueing to avoid double free Bin Luo (University of Electronic Science and Technology of China)
2026-11-27 13:40 ` [PATCH v5 3/5] nfc: digital: complete DEP data exchange on terminal errors Bin Luo (University of Electronic Science and Technology of China)
2026-11-27 13:40 ` [PATCH v5 4/5] nfc: nci: drop stale rx_data_reassembly on errors, timeout, and close Bin Luo (University of Electronic Science and Technology of China)
2026-11-27 13:40 ` [PATCH v5 5/5] nfc: preserve NCI data status error codes Bin Luo (University of Electronic Science and Technology of China)
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=20261127134029.1813-1-luob87709@gmail.com \
--to=luob87709@gmail.com \
--cc=david@ixit.cz \
--cc=johan@kernel.org \
--cc=kuba@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