[PATCH v3 0/2] spi: spi-qpic-snand: avoid memory corruption

Gabor Juhos posted 2 patches 3 months, 3 weeks ago
drivers/mtd/nand/qpic_common.c       | 30 ++++++++++++++++++++++++++----
drivers/spi/spi-qpic-snand.c         | 16 ++++++++++++++++
include/linux/mtd/nand-qpic-common.h |  8 ++++++++
3 files changed, 50 insertions(+), 4 deletions(-)
[PATCH v3 0/2] spi: spi-qpic-snand: avoid memory corruption
Posted by Gabor Juhos 3 months, 3 weeks ago
The 'spi-qpic-nand' driver may cause memory corruption under some
circumstances. The first patch in the series changes the driver to
avoid that, whereas the second adds some sanity checks to the common
QPIC code in order to make detecting such errors easier in the future.

Preferably, the two patches should go along in via the SPI tree.
It is not a strict requirement though, in the case the second patch
gets included separately through the MTD tree it reveals the bug
which is fixed in the first patch.

Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
---
Changes in v3:
  - rebase on top of current spi/for-6.16
  - add 'Acked-by' tag from Miquel to patch 2
  - Link to v2: https://lore.kernel.org/r/20250529-qpic-snand-avoid-mem-corruption-v2-0-2f0d13afc7d2@gmail.com

Changes in v2:
  - collect offered tags
  - reduce kernel log spam in commit description of patch 1
  - remove inline error printing function from patch 2, and adjust the
    commit message of the patch
  - Link to v1: https://lore.kernel.org/r/20250525-qpic-snand-avoid-mem-corruption-v1-0-5fe528def7fb@gmail.com

---
Gabor Juhos (2):
      spi: spi-qpic-snand: reallocate BAM transactions
      mtd: nand: qpic_common: prevent out of bounds access of BAM arrays

 drivers/mtd/nand/qpic_common.c       | 30 ++++++++++++++++++++++++++----
 drivers/spi/spi-qpic-snand.c         | 16 ++++++++++++++++
 include/linux/mtd/nand-qpic-common.h |  8 ++++++++
 3 files changed, 50 insertions(+), 4 deletions(-)
---
base-commit: d57e92dd660014ccac884eda616cafc7b04601e0
change-id: 20250523-qpic-snand-avoid-mem-corruption-301afabeb0eb

Best regards,
-- 
Gabor Juhos <j4g8y7@gmail.com>
Re: [PATCH v3 0/2] spi: spi-qpic-snand: avoid memory corruption
Posted by Mark Brown 3 months, 1 week ago
On Wed, 18 Jun 2025 22:22:48 +0200, Gabor Juhos wrote:
> The 'spi-qpic-nand' driver may cause memory corruption under some
> circumstances. The first patch in the series changes the driver to
> avoid that, whereas the second adds some sanity checks to the common
> QPIC code in order to make detecting such errors easier in the future.
> 
> Preferably, the two patches should go along in via the SPI tree.
> It is not a strict requirement though, in the case the second patch
> gets included separately through the MTD tree it reveals the bug
> which is fixed in the first patch.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/2] spi: spi-qpic-snand: reallocate BAM transactions
      commit: d85d0380292a7e618915069c3579ae23c7c80339
[2/2] mtd: nand: qpic_common: prevent out of bounds access of BAM arrays
      commit: ddaad4ad774d4ae02047ef873a8e38f62a4b7b01

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
Re: [PATCH v3 0/2] spi: spi-qpic-snand: avoid memory corruption
Posted by Mark Brown 3 months, 2 weeks ago
On Wed, Jun 18, 2025 at 10:22:48PM +0200, Gabor Juhos wrote:
> The 'spi-qpic-nand' driver may cause memory corruption under some
> circumstances. The first patch in the series changes the driver to
> avoid that, whereas the second adds some sanity checks to the common
> QPIC code in order to make detecting such errors easier in the future.
> 
> Preferably, the two patches should go along in via the SPI tree.
> It is not a strict requirement though, in the case the second patch
> gets included separately through the MTD tree it reveals the bug
> which is fixed in the first patch.

Miquel, are you OK with this plan for merging via the SPI tree?
Re: [PATCH v3 0/2] spi: spi-qpic-snand: avoid memory corruption
Posted by Miquel Raynal 3 months, 2 weeks ago
Hi Mark,

On 25/06/2025 at 23:43:23 +01, Mark Brown <broonie@kernel.org> wrote:

> On Wed, Jun 18, 2025 at 10:22:48PM +0200, Gabor Juhos wrote:
>> The 'spi-qpic-nand' driver may cause memory corruption under some
>> circumstances. The first patch in the series changes the driver to
>> avoid that, whereas the second adds some sanity checks to the common
>> QPIC code in order to make detecting such errors easier in the future.
>> 
>> Preferably, the two patches should go along in via the SPI tree.
>> It is not a strict requirement though, in the case the second patch
>> gets included separately through the MTD tree it reveals the bug
>> which is fixed in the first patch.
>
> Miquel, are you OK with this plan for merging via the SPI tree?

Absolutely, my Ack is already there, thanks for asking.

Miquèl