From: Simon Horman <horms@kernel.org>
To: Aamir Ahmed <elb12345@hotmail.co.uk>
Cc: Samuel Mendoza-Jonas <sam@mendozajonas.com>,
Paul Fertser <fercerpav@gmail.com>, Joel Stanley <joel@jms.id.au>,
Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2 1/2] net: ncsi: validate response packet length before accessing fields
Date: Wed, 16 Sep 2026 13:05:19 +0100 [thread overview]
Message-ID: <20260916120519.GB51261@horms.kernel.org> (raw)
In-Reply-To: <AS8P251MB000151B1FA33EDC00D8275D2C8BD2@AS8P251MB0001.EURP251.PROD.OUTLOOK.COM>
On Sat, Sep 12, 2026 at 07:09:37PM +0100, Aamir Ahmed wrote:
> ncsi_validate_rsp_pkt() takes a pointer to the response header and then
> reads the checksum at the end of the padded payload, without checking
> that the skb holds either. ncsi_rcv_rsp() reads the common header the
> same way before that.
>
> For response types with a fixed payload the header length check is not
> enough: a short frame whose header claims the expected length passes it.
> For the variable-length types (GP, OEM, PLDM, GMCMA) the payload comes
> from the header itself, so the check is tautological.
>
> The response skb is not guaranteed to be linear, so use pskb_may_pull()
> rather than testing skb->len, and take the header pointers afterwards -
> pskb_may_pull() may move the data. The payload is padded to four bytes
> and the checksum occupies the last four, so the validator pulls
> ALIGN(payload, 4) rather than payload. ncsi_rcv_rsp() keeps a copy of
> the packet type for its error paths, as its own header pointer does not
> survive the validator.
>
> Fixes: 138635cc27c9 ("net/ncsi: NCSI response packet handler")
> Assisted-by: LLM
> Signed-off-by: Aamir Ahmed <elb12345@hotmail.co.uk>
> ---
> v2:
> - use pskb_may_pull() instead of testing skb->len, and take the header
> pointer after the call (Simon)
> - pull ALIGN(payload, 4), not payload: the checksum sits in the last
> four bytes of the padded payload, so the v1 bound did not cover it
> - guard the common-header read in ncsi_rcv_rsp() too, and keep a copy
> of the packet type, since its header pointer does not survive the
> validator's pull
> - correct the Fixes: tag; v1 quoted a hash that does not resolve, and
> the blame for this file is the commit that added it
> - drop the GMCMA hunk; it belongs with its own handler
> - add the Assisted-by: LLM tag (Simon, Greg)
> - name the target tree in the subject
> v1: https://lore.kernel.org/netdev/AS8P251MB0001E6ABBE0B6809D3E21B9DC8B32@AS8P251MB0001.EURP251.PROD.OUTLOOK.COM/
Reviewed-by: Simon Horman <horms@kernel.org>
For future reference:
This patch-set has two patches. But they seem to have been sent as two
separate email threads. Which confuses some tooling, such as Sashiko.
Using tools such as b4 or git send-email (in conjunction with git
format-patch) should avoid this problem.
next prev parent reply other threads:[~2026-09-16 12:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-12 18:09 Aamir Ahmed
2026-09-16 12:05 ` Simon Horman [this message]
2026-09-17 0:17 ` Jakub Kicinski
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=20260916120519.GB51261@horms.kernel.org \
--to=horms@kernel.org \
--cc=edumazet@google.com \
--cc=elb12345@hotmail.co.uk \
--cc=fercerpav@gmail.com \
--cc=joel@jms.id.au \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sam@mendozajonas.com \
/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®