This is a note to let you know that I've just added the patch titled mtd: spi-nor: sfdp: Fix wrong erase type bitmask for overlaid region to the 5.11-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-spi-nor-sfdp-fix-wrong-erase-type-bitmask-for-overlaid-region.patch and it can be found in the queue-5.11 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From abdf5a5ef9652bad4d58058bc22ddf23543ba3e1 Mon Sep 17 00:00:00 2001 From: Takahiro Kuwano <Takahiro.Kuwano@xxxxxxxxxxxx> Date: Fri, 2 Oct 2020 14:17:59 +0900 Subject: mtd: spi-nor: sfdp: Fix wrong erase type bitmask for overlaid region From: Takahiro Kuwano <Takahiro.Kuwano@xxxxxxxxxxxx> commit abdf5a5ef9652bad4d58058bc22ddf23543ba3e1 upstream. At the time spi_nor_region_check_overlay() is called, the erase types are sorted in ascending order of erase size. The 'erase_type' should be masked with 'BIT(erase[i].idx)' instead of 'BIT(i)'. Fixes: b038e8e3be72 ("mtd: spi-nor: parse SFDP Sector Map Parameter Table") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@xxxxxxxxxxxx> [ta: Add Fixes tag and Cc to stable] Signed-off-by: Tudor Ambarus <tudor.ambarus@xxxxxxxxxxxxx> Link: https://lore.kernel.org/r/fd90c40d5b626a1319a78fc2bcee79a8871d4d57.1601612872.git.Takahiro.Kuwano@xxxxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/mtd/spi-nor/sfdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mtd/spi-nor/sfdp.c +++ b/drivers/mtd/spi-nor/sfdp.c @@ -788,7 +788,7 @@ spi_nor_region_check_overlay(struct spi_ int i; for (i = 0; i < SNOR_ERASE_TYPE_MAX; i++) { - if (!(erase_type & BIT(i))) + if (!(erase[i].size && erase_type & BIT(erase[i].idx))) continue; if (region->size & erase[i].size_mask) { spi_nor_region_mark_overlay(region); Patches currently in stable-queue which might be from Takahiro.Kuwano@xxxxxxxxxxxx are queue-5.11/mtd-spi-nor-core-add-erase-size-check-for-erase-command-initialization.patch queue-5.11/mtd-spi-nor-sfdp-fix-wrong-erase-type-bitmask-for-overlaid-region.patch queue-5.11/mtd-spi-nor-sfdp-fix-last-erase-region-marking.patch queue-5.11/mtd-spi-nor-core-fix-erase-type-discovery-for-overlaid-region.patch