The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: "Lee Jones" <lee@kernel.org>, "Mark Brown" <broonie@kernel.org>,
	"Foon Tan" <lftan@altera.com>,
	"Graham Moore" <grmoore@opensource.altera.com>,
	"Murugan R" <vadivel.muruganx.ramuthevar@intel.com>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	"Pratyush Yadav" <p.yadav@ti.com>, "Dhruva Gole" <d-gole@ti.com>,
	<linux-spi@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 06/10] spi: cadence-quadspi: Validate num-cs against CQSPI_MAX_CHIPSELECT
Date: Fri, 27 Nov 2026 18:22:43 +0100	[thread overview]
Message-ID: <DN6611WYQN57.39FY9Q6KK65TS@bootlin.com> (raw)
In-Reply-To: <20261127153158.2969573-7-lee@kernel.org>

Hello Lee,

On Fri Nov 27, 2026 at 4:31 PM CET, Lee Jones wrote:
> cqspi_of_get_pdata() reads cqspi->num_chipselect from the "num-cs"
> Device Tree property without checking that it fits within
> CQSPI_MAX_CHIPSELECT.  cqspi_setup_flash() then validates each child
> node's chip select only against cqspi->num_chipselect before indexing
> cqspi->f_pdata[CQSPI_MAX_CHIPSELECT], allowing an out-of-bounds write
> if a DT specifies more than CQSPI_MAX_CHIPSELECT chip selects.
>
> Reject "num-cs" values exceeding CQSPI_MAX_CHIPSELECT in
> cqspi_of_get_pdata(), and store cs as u32 in cqspi_setup_flash() to
> match of_property_read_u32().
>
> Fixes: 0d62c64a8e48 ("spi: cadence-qspi: assert each subnode flash CS is valid")
> Closes: https://sashiko.dev/#/bug/linux-cd463fc8-1b94-4bcf-8d06-fae21b88894c
> Signed-off-by: Lee Jones <lee@kernel.org>
> ---
> v1 => v2:
>  - Reject num-cs values exceeding CQSPI_MAX_CHIPSELECT in
>    cqspi_of_get_pdata() and store cs as u32 in cqspi_setup_flash(),
>    per Theo Lebrun's review.
>  - Simplify the commit message and drop the stable tag, per Theo
>    Lebrun's review.
>
>  drivers/spi/spi-cadence-quadspi.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)

Reviewed-by: Théo Lebrun <theo.lebrun@bootlin.com>

Thanks,

--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


  reply	other threads:[~2026-11-27 17:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 15:31 [PATCH v2 00/10] spi: Fix DMA, bounds, clock, and chip-select bugs Lee Jones
2026-11-27 15:31 ` [PATCH v2 01/10] spi: fsl-cpm: Map the zero page's address, not its struct page Lee Jones
2026-11-27 15:31 ` [PATCH v2 02/10] spi: bcm2835: Store native chip-select GPIO descriptor per device Lee Jones
2026-11-27 15:31 ` [PATCH v2 03/10] spi: ch341: Limit transfers to the hardware packet size Lee Jones
2026-11-27 15:31 ` [PATCH v2 04/10] spi: sprd-adi: Do not copy uninitialised data to rx_buf on read failure Lee Jones
2026-11-27 15:31 ` [PATCH v2 05/10] spi: topcliff-pch: Advance tx_buf between DMA chunks Lee Jones
2026-11-27 15:31 ` [PATCH v2 06/10] spi: cadence-quadspi: Validate num-cs against CQSPI_MAX_CHIPSELECT Lee Jones
2026-11-27 17:22   ` Théo Lebrun [this message]
2026-11-27 15:31 ` [PATCH v2 07/10] spi: cadence-xspi: Zero the tail word in m_iowriteq() Lee Jones
2026-11-27 15:31 ` [PATCH v2 08/10] spi: fsl-qspi: Propagate clock errors from fsl_qspi_select_mem() Lee Jones
2026-11-27 15:31 ` [PATCH v2 09/10] spi: cadence-xspi: Advance tx pointer between Marvell b0 chunks Lee Jones
2026-11-27 15:31 ` [PATCH v2 10/10] spi: cadence-xspi: Skip tail read for qword-aligned Marvell b0 receives Lee Jones

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=DN6611WYQN57.39FY9Q6KK65TS@bootlin.com \
    --to=theo.lebrun@bootlin.com \
    --cc=broonie@kernel.org \
    --cc=d-gole@ti.com \
    --cc=grmoore@opensource.altera.com \
    --cc=lee@kernel.org \
    --cc=lftan@altera.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=p.yadav@ti.com \
    --cc=vadivel.muruganx.ramuthevar@intel.com \
    --cc=vigneshr@ti.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