mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Aamir Ahmed <elb12345@hotmail.co.uk>
Cc: David Heidelberg <david@ixit.cz>,
	linux-nfc@lists.linux.dev, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] nfc: llcp: validate PDU size in nfc_llcp_recv_dm() and nfc_llcp_recv_hdlc()
Date: Mon, 7 Sep 2026 16:33:06 +0200	[thread overview]
Message-ID: <2026090735-overhead-epidermal-9d2d@gregkh> (raw)
In-Reply-To: <AS8P251MB0001E8602F36054CDD8979A2C8B32@AS8P251MB0001.EURP251.PROD.OUTLOOK.COM>

On Mon, Sep 07, 2026 at 12:36:45AM +0100, Aamir Ahmed wrote:
> nfc_llcp_recv_dm() reads the reason byte at skb->data[2], and
> nfc_llcp_recv_hdlc() reads the sequence byte at the same offset
> through nfc_llcp_ns() and nfc_llcp_nr().  Both run after
> __nfc_llcp_recv(), which only guarantees LLCP_HEADER_SIZE (2) bytes
> via pskb_may_pull().
> 
> A malformed PDU that is exactly two bytes long -- delivered directly by
> the NFC controller, or as an aggregated PDU inside an AGF frame whose
> inner length field is 2 -- causes both handlers to read one byte past
> the guaranteed data.  In the direct case the byte is whatever follows
> the valid payload in the skb buffer.  In the AGF case the inner skb is
> allocated by nfc_alloc_recv_skb() with exactly two bytes of payload, so
> the read is past the meaningful data and into whatever the slab
> allocator left there.
> 
> For DM, the stale reason byte selects between NOBOUND/REJ and the
> default socket-lookup path, potentially closing the wrong socket.  For
> HDLC, the stale sequence byte corrupts N(S)/N(R) tracking: a bogus
> N(R) drains the tx_pending_queue unconditionally, dropping in-flight I
> frames and breaking the connection.
> 
> Add a minimum-length check to each handler: DM requires
> LLCP_HEADER_SIZE + 1 (the reason byte) and HDLC requires
> LLCP_HEADER_SIZE + LLCP_SEQUENCE_SIZE.
> 
> Fixes: d646960f7986 ("NFC: Initial LLCP support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Aamir Ahmed <elb12345@hotmail.co.uk>
> ---
>  net/nfc/llcp_core.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)

For all of these different patches, did you forget to add the required
"Assisted-by:" tag?

Please resubmit them all with that included.

thanks,

greg k-h

  reply	other threads:[~2026-09-07 14:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-06 23:36 Aamir Ahmed
2026-09-07 14:33 ` Greg KH [this message]
2026-09-07 23:08   ` Aamir Ahmed
2026-09-10  3:38 netdev-bot+sashiko

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=2026090735-overhead-epidermal-9d2d@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=david@ixit.cz \
    --cc=elb12345@hotmail.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfc@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --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 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®