All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>
Cc: Shahed Shaikh <shshaikh@marvell.com>,
	Manish Chopra <manishc@marvell.com>,
	GR-Linux-NIC-Dev@marvell.com, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2] net: qlcnic: validate unified ROM sections before loading
Date: Wed, 19 Aug 2026 15:18:09 +0100	[thread overview]
Message-ID: <20260819141809.GS265046@horms.kernel.org> (raw)
In-Reply-To: <20260816052109.4607-1-pengpeng@iscas.ac.cn>

On Sun, Aug 16, 2026 at 01:21:09PM +0800, Pengpeng Hou wrote:
> The unified ROM parser reads directory, product, and data-descriptor fields
> from the firmware file.  Existing validation forms table and data ends with
> unchecked additions and multiplications.  Malformed values can wrap before
> they are compared with the firmware size.  The parser also dereferences
> typed pointers at firmware-controlled offsets.
> 
> Valid descriptor extents alone are insufficient for the consumers.  The
> loader reads a fixed-size bootloader regardless of its declared size, the
> version parser assumes a 17-byte tail, and a partial final firmware word is
> read as a full u64.  A truncated image can therefore make the driver read
> beyond the firmware allocation during validation or loading.
> 
> Replace the pointer-returning parser with bounded range helpers.  Validate
> table entry sizes, descriptor indices, section ranges, the fixed
> bootloader load length, and the version tail before exposing any section.
> Read all file fields with unaligned little-endian accessors and assemble a
> partial final word from only the bytes that remain.  Apply the same range
> checks to the legacy image before reading its fixed fields.
> 
> Fixes: af19b49152bd ("qlcnic: Qlogic ethernet driver for CNA devices")
> Assisted-by: Codex:gpt-5
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
> Changes since v1:
> - follow reverse-xmas-tree declaration order and drop unrelated whitespace
> - replace firmware structure casts with bounded unaligned reads
> - validate directory and data-table entry sizes and descriptor indices
> - require the bootloader section to cover the fixed load length
> - require the firmware section to contain the 17-byte version tail
> - avoid a full-u64 read for a partial final firmware word
> - validate fixed legacy-image fields before reading them
> 
> v1: https://lore.kernel.org/all/20260706093601.81535-1-pengpeng@iscas.ac.cn/
> 
> Validation:
> - scripts/checkpatch.pl --no-tree --strict: clean
> - git diff --check: clean
> - manual source-level audit of directory, product, descriptor, version, and
>   loader consumers

Thanks for the updates.
And for including information on your validation steps.

Reviewed-by: Simon Horman <horms@kernel.org>


      reply	other threads:[~2026-08-19 14:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-16  5:21 [PATCH net v2] net: qlcnic: validate unified ROM sections before loading Pengpeng Hou
2026-08-19 14:18 ` 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=20260819141809.GS265046@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=GR-Linux-NIC-Dev@marvell.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manishc@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pengpeng@iscas.ac.cn \
    --cc=shshaikh@marvell.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 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.