Patch "mtd: spinand: macronix: use scratch buffer for DMA operation" has been added to the 6.1-stable tree

gregkh at linuxfoundation.org gregkh at linuxfoundation.org
Sat Mar 21 07:43:43 PDT 2026


This is a note to let you know that I've just added the patch titled

    mtd: spinand: macronix: use scratch buffer for DMA operation

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mtd-spinand-macronix-use-scratch-buffer-for-dma-operation.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable at vger.kernel.org> know about it.


>From stable+bounces-224526-greg=kroah.com at vger.kernel.org Tue Mar 10 18:16:43 2026
From: Frieder Schrempf <frieder at fris.de>
Date: Tue, 10 Mar 2026 18:15:44 +0100
Subject: mtd: spinand: macronix: use scratch buffer for DMA operation
To: Greg Kroah-Hartman <gregkh at linuxfoundation.org>, Sasha Levin <sashal at kernel.org>, stable at vger.kernel.org, linux-kernel at vger.kernel.org, linux-mtd at lists.infradead.org, Miquel Raynal <miquel.raynal at bootlin.com>, Richard Weinberger <richard at nod.at>, Vignesh Raghavendra <vigneshr at ti.com>
Cc: Daniel Golle <daniel at makrotopia.org>, Dhruva Gole <d-gole at ti.com>, Frieder Schrempf <frieder.schrempf at kontron.de>
Message-ID: <20260310171544.1568499-1-frieder at fris.de>

From: Daniel Golle <daniel at makrotopia.org>

[ Upstream commit ebed787a0becb9354f0a23620a5130cccd6c730c ]

The mx35lf1ge4ab_get_eccsr() function uses an SPI DMA operation to
read the eccsr, hence the buffer should not be on stack. Since commit
380583227c0c7f ("spi: spi-mem: Add extra sanity checks on the op param")
the kernel emmits a warning and blocks such operations.

Use the scratch buffer to get eccsr instead of trying to directly read
into a stack-allocated variable.

Signed-off-by: Daniel Golle <daniel at makrotopia.org>
Reviewed-by: Dhruva Gole <d-gole at ti.com>
Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
Link: https://lore.kernel.org/linux-mtd/Y8i85zM0u4XdM46z@makrotopia.org
Signed-off-by: Frieder Schrempf <frieder.schrempf at kontron.de>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 drivers/mtd/nand/spi/macronix.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/mtd/nand/spi/macronix.c
+++ b/drivers/mtd/nand/spi/macronix.c
@@ -83,9 +83,10 @@ static int mx35lf1ge4ab_ecc_get_status(s
 		 * in order to avoid forcing the wear-leveling layer to move
 		 * data around if it's not necessary.
 		 */
-		if (mx35lf1ge4ab_get_eccsr(spinand, &eccsr))
+		if (mx35lf1ge4ab_get_eccsr(spinand, spinand->scratchbuf))
 			return nanddev_get_ecc_conf(nand)->strength;
 
+		eccsr = *spinand->scratchbuf;
 		if (WARN_ON(eccsr > nanddev_get_ecc_conf(nand)->strength ||
 			    !eccsr))
 			return nanddev_get_ecc_conf(nand)->strength;


Patches currently in stable-queue which might be from frieder at fris.de are

queue-6.1/regulator-pca9450-make-irq-optional.patch
queue-6.1/mtd-spinand-macronix-use-scratch-buffer-for-dma-operation.patch



More information about the linux-mtd mailing list