Netdev List
 help / color / mirror / Atom feed
* [PATCH v5 0/5] net/nfc: fix skb ownership, reassembly cleanup, and NCI status errors
@ 2026-11-27 13:40 Bin Luo (University of Electronic Science and Technology of China)
  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)
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Bin Luo (University of Electronic Science and Technology of China) @ 2026-11-27 13:40 UTC (permalink / raw)
  To: oe-linux-nfc; +Cc: johan, david, kuba, netdev

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-27 13:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 13:40 [PATCH v5 0/5] net/nfc: fix skb ownership, reassembly cleanup, and NCI status errors Bin Luo (University of Electronic Science and Technology of China)
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)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox