This is a note to let you know that I've just added the patch titled mtd: rawnand: arasan: Prevent an unsupported configuration to the 5.10-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-rawnand-arasan-prevent-an-unsupported-configuration.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From fc9e18f9e987ad46722dad53adab1c12148c213c Mon Sep 17 00:00:00 2001 From: Miquel Raynal <miquel.raynal@xxxxxxxxxxx> Date: Fri, 8 Oct 2021 18:36:40 +0200 Subject: mtd: rawnand: arasan: Prevent an unsupported configuration From: Miquel Raynal <miquel.raynal@xxxxxxxxxxx> commit fc9e18f9e987ad46722dad53adab1c12148c213c upstream. Under the following conditions: * after rounding up by 4 the number of bytes to transfer (this is related to the controller's internal constraints), * if this (rounded) amount of data is situated beyond the end of the device, * and only in NV-DDR mode, the Arasan NAND controller timeouts. This currently can happen in a particular helper used when picking software ECC algorithms. Let's prevent this situation by refusing to use the NV-DDR interface with software engines. Fixes: 4edde6031458 ("mtd: rawnand: arasan: Support NV-DDR interface") Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx> Link: https://lore.kernel.org/linux-mtd/20211008163640.1753821-1-miquel.raynal@xxxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/mtd/nand/raw/arasan-nand-controller.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) --- a/drivers/mtd/nand/raw/arasan-nand-controller.c +++ b/drivers/mtd/nand/raw/arasan-nand-controller.c @@ -891,6 +891,21 @@ static int anfc_setup_interface(struct n nvddr = nand_get_nvddr_timings(conf); if (IS_ERR(nvddr)) return PTR_ERR(nvddr); + + /* + * The controller only supports data payload requests which are + * a multiple of 4. In practice, most data accesses are 4-byte + * aligned and this is not an issue. However, rounding up will + * simply be refused by the controller if we reached the end of + * the device *and* we are using the NV-DDR interface(!). In + * this situation, unaligned data requests ending at the device + * boundary will confuse the controller and cannot be performed. + * + * This is something that happens in nand_read_subpage() when + * selecting software ECC support and must be avoided. + */ + if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_SOFT) + return -ENOTSUPP; } else { sdr = nand_get_sdr_timings(conf); if (IS_ERR(sdr)) Patches currently in stable-queue which might be from miquel.raynal@xxxxxxxxxxx are queue-5.10/mtd-partitions-fix-refcount-leak-in-parse_redboot_of.patch queue-5.10/mtd-rawnand-add-a-helper-to-clarify-the-interface-co.patch queue-5.10/mtd-rawnand-arasan-check-the-proposed-data-interface.patch queue-5.10/mtd-st_spi_fsm-add-a-clk_disable_unprepare-in-.probe.patch queue-5.10/mtd-sm_ftl-fix-deadlock-caused-by-cancel_work_sync-i.patch queue-5.10/mtd-rawnand-arasan-update-nand-bus-clock-instead-of-system-clock.patch queue-5.10/mtd-maps-fix-refcount-leak-in-of_flash_probe_versati.patch queue-5.10/mtd-rawnand-add-nv-ddr-timings.patch queue-5.10/mtd-rawnand-arasan-support-nv-ddr-interface.patch queue-5.10/mtd-rawnand-arasan-fix-clock-rate-in-nv-ddr.patch queue-5.10/mtd-rawnand-arasan-prevent-an-unsupported-configuration.patch queue-5.10/mtd-maps-fix-refcount-leak-in-ap_flash_init.patch queue-5.10/mtd-rawnand-meson-fix-a-potential-double-free-issue.patch queue-5.10/mtd-rawnand-arasan-fix-a-macro-parameter.patch