From: Simon Horman <horms@kernel.org>
To: Aamir Ahmed <elb12345@hotmail.co.uk>
Cc: David Heidelberg <david@ixit.cz>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Samuel Ortiz <sameo@linux.intel.com>,
"John W. Linville" <linville@tuxdriver.com>,
oe-linux-nfc@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH net v2] nfc: llcp: drop truncated I/RR/RNR PDUs in nfc_llcp_recv_hdlc()
Date: Thu, 17 Sep 2026 12:45:35 +0100 [thread overview]
Message-ID: <20260917114535.GZ51261@horms.kernel.org> (raw)
In-Reply-To: <AS8P251MB0001789BBF04B72745C7D96BC8BA2@AS8P251MB0001.EURP251.PROD.OUTLOOK.COM>
On Tue, Sep 15, 2026 at 07:54:27PM +0100, Aamir Ahmed wrote:
> nfc_llcp_recv_hdlc() reads the sequence byte skb->data[2], via
> nfc_llcp_ns()/nfc_llcp_nr(), before any length check. The receive path
> only guarantees the two-byte LLCP header -- __nfc_llcp_recv() checks it
> with pskb_may_pull() and nfc_llcp_recv_agf() admits two-byte inner PDUs
> -- so a two-byte I, RR or RNR PDU reads one byte of uninitialised skb
> tailroom. The byte becomes N(R)/N(S); a peer can already set those with
> a well-formed PDU, so this is acting on uninitialised memory, not new
> peer control.
>
> Guard the read with pskb_may_pull(), as commit 95674f506c63 ("nfc: llcp:
> reject PDUs shorter than the LLCP header") did for the two-byte header,
> so the sequence byte is present and linear before it is read. RR and RNR
> PDUs are LLCP_HEADER_SIZE + LLCP_SEQUENCE_SIZE bytes and an I PDU is
> longer, so no valid frame is rejected; a truncated PDU is malformed, so
> return without a DM reply.
>
> Fixes: d646960f7986 ("NFC: Initial LLCP support")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Aamir Ahmed <elb12345@hotmail.co.uk>
> ---
>
> Notes:
> v2:
> - scope to nfc_llcp_recv_hdlc() only; the recv_dm() half duplicated
> Lekë Hapçiu's pending fix (20260729011547.19191-2-snowwlake@icloud.com)
> - return silently instead of answering DM(NOCONN) as v1 did, which would
> close an established peer connection (Sashiko)
> - guard with pskb_may_pull(), matching commit 95674f506c63
> - add Assisted-by, target net, Cc the right lists, reword the changelog
> v1: https://lore.kernel.org/netdev/AS8P251MB0001E8602F36054CDD8979A2C8B32@AS8P251MB0001.EURP251.PROD.OUTLOOK.COM/
>
> Built net/nfc/llcp_core.o on v7.3-rc1 with KASAN and W=1, no warnings.
> No NFC hardware; not runtime-tested.
Reviewed-by: Simon Horman <horms@kernel.org>
prev parent reply other threads:[~2026-09-17 11:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 18:54 [PATCH net v2] nfc: llcp: drop truncated I/RR/RNR PDUs in nfc_llcp_recv_hdlc() Aamir Ahmed
2026-09-17 11:45 ` Simon Horman [this message]
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=20260917114535.GZ51261@horms.kernel.org \
--to=horms@kernel.org \
--cc=davem@davemloft.net \
--cc=david@ixit.cz \
--cc=edumazet@google.com \
--cc=elb12345@hotmail.co.uk \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=netdev@vger.kernel.org \
--cc=oe-linux-nfc@lists.linux.dev \
--cc=pabeni@redhat.com \
--cc=sameo@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.