Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Pengpeng Hou <hppiscas@163.com>
Cc: Elad Nachman <enachman@marvell.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2] net: prestera: avoid overreading a short firmware tail
Date: Tue, 20 Oct 2026 12:02:36 -0700	[thread overview]
Message-ID: <20261020120236.56f680c3@kernel.org> (raw)
In-Reply-To: <20261014032540.14311-1-hppiscas@163.com>

On Wed, 14 Oct 2026 11:25:40 +0800 Pengpeng Hou wrote:
> prestera_ldr_fw_send() passes complete 1024-byte blocks to the loader
> and then sends fw_size - pos as the final chunk. Firmware header validation
> does not require the payload size to be a multiple of four. Consequently
> that last chunk can end with one to three bytes, while prestera_ldr_send()
> still loads a full u32 from it and transfers bytes beyond the supplied
> firmware image to the device.
> 
> Reserve space for the rounded-up transfer, use unaligned-safe full-word
> loads, and construct the final word from only the remaining bytes with
> zero padding. The firmware image-size register still describes the exact
> payload size. Preserve the existing native-word load and writel_relaxed()
> byte-order convention.

Sounds like well formed image should not require such writes,
so why not reject such send calls as an error?

      parent reply	other threads:[~2026-10-20 19:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14  3:25 [PATCH net v2] net: prestera: avoid overreading a short firmware tail Pengpeng Hou
2026-10-14  3:30 ` netdev-bot+sinfo
2026-10-20 19:02   ` Jakub Kicinski
2026-10-20 19:02 ` Jakub Kicinski [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=20261020120236.56f680c3@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=enachman@marvell.com \
    --cc=hppiscas@163.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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