mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net v2 0/3] net/nfc: three peer-reachable skb bugs in LLCP and NCI
@ 2026-11-30  1:22 Piyus Kedia
  2026-11-30  1:22 ` [PATCH net v2 1/3] net/nfc: llcp: fix the 16-bit truncation that overruns the SNL response skb Piyus Kedia
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Piyus Kedia @ 2026-11-30  1:22 UTC (permalink / raw)
  To: David Heidelberg, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Willem de Bruijn, Simon Horman
  Cc: oe-linux-nfc, netdev, linux-kernel, Kapil Vaswani

Three independent bugs in the NFC receive paths: a 16-bit truncation that
overruns an skb and panics, a use-after-free on a received frame, and a
NULL skb handed to the nfc core.  They touch three different files and have
three different causes, so they can be taken in any order; they are posted
as one series only because v1 went out as three numbered patches in three
threads, which is what the review objected to.

1/3 holds the SNL allocation size in a size_t instead of a u16, so a large
    SDREQ burst cannot wrap it and make skb_put() trip skb_over_panic().
2/3 takes the skb reference before sock_queue_rcv_skb() publishes the frame
    on the receive queue rather than after, and releases it on failure.
3/3 stops nci_add_rx_data_frag() forwarding a NULL skb to the nfc core
    after it has freed it on the reassembly error path.

Each was reproduced on net.git main under KASAN, and the patched kernel is
clean on the same reproducer with ordinary NFC traffic unaffected.  Found
by AI-driven fuzzing built on top of syzkaller; every analysis was then
checked by hand against the code, as each patch records.  The reproducers
are not posted - they go to anyone who asks for them.

Changes in v2, all of them from Willem de Bruijn's review:

 - a Fixes: tag on each patch.  v1 had none because the clone we were
   working from does not reach back that far; from a full one they are
     1/3  e0ae7bac06cc - gave nfc_llcp_allocate_snl() a size_t length to
          add into the u16 that was already there
     2/3  1727cf937401 - put skb_get() after sock_queue_rcv_skb() in both
          handlers
     3/3  122c195872e9 - added the target-mode exit that forwards the skb.
          The NULL itself dates to 2011, but until this commit the shared
          exit path only reached nci_data_exchange_complete(), which
          accepts one.
 - this cover letter, and one series rather than three numbered threads
 - the full get_maintainer.pl recipient list
 - a Link: to each bug report in the commit message, instead of threading
   the patch under the report with In-Reply-To

v1 of the three patches, each threaded under its own bug report:
  https://lore.kernel.org/netdev/20261123023548.3351531-2-piyus@iiitd.ac.in/
  https://lore.kernel.org/netdev/20261123023519.3350997-2-piyus@iiitd.ac.in/
  https://lore.kernel.org/netdev/20261123023446.3350387-2-piyus@iiitd.ac.in/

The review:
  https://lore.kernel.org/netdev/willemb.360aecefa3166@google.com/

Piyus Kedia (3):
  net/nfc: llcp: fix the 16-bit truncation that overruns the SNL
    response skb
  net/nfc: llcp: take the skb reference before queueing it to the socket
  net/nfc: nci: do not hand a NULL skb to the nfc core

 net/nfc/llcp_commands.c |  2 +-
 net/nfc/llcp_core.c     | 33 +++++++++++++++++++--------------
 net/nfc/nci/data.c      | 15 +++++++++++----
 3 files changed, 31 insertions(+), 19 deletions(-)


base-commit: 9437ee8b6cf607e883b36e44bd755968daaebd48
-- 
2.34.1


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

end of thread, other threads:[~2026-12-01  2:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-30  1:22 [PATCH net v2 0/3] net/nfc: three peer-reachable skb bugs in LLCP and NCI Piyus Kedia
2026-11-30  1:22 ` [PATCH net v2 1/3] net/nfc: llcp: fix the 16-bit truncation that overruns the SNL response skb Piyus Kedia
2026-12-01  2:15   ` netdev-bot+sashiko
2026-11-30  1:22 ` [PATCH net v2 2/3] net/nfc: llcp: take the skb reference before queueing it to the socket Piyus Kedia
2026-12-01  2:15   ` netdev-bot+sashiko
2026-11-30  1:22 ` [PATCH net v2 3/3] net/nfc: nci: do not hand a NULL skb to the nfc core Piyus Kedia
2026-12-01  2:15   ` netdev-bot+sashiko

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

all inboxes | Powered by JetHome®