linux-stable/drivers/mtd
Boris Brezillon 3ca59bf1fb mtd: Make sure mtd->erasesize is valid even if the partition is of size 0
commit ad46351530 upstream.

Commit 33f45c44d6 ("mtd: Do not allow MTD devices with inconsistent
erase properties") introduced a check to make sure ->erasesize and
->_erase values are consistent with the MTD_NO_ERASE flag.
This patch did not take the 0 bytes partition case into account which
can happen when the defined partition is outside the flash device memory
range. Fix that by setting the partition erasesize to the parent
erasesize.

Fixes: 33f45c44d6 ("mtd: Do not allow MTD devices with inconsistent erase properties")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: <stable@vger.kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Boris Brezillon <bbrezillon@kernel.org>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-15 08:10:10 +01:00
..
chips NAND core changes: 2018-08-11 12:15:19 +02:00
devices mtd: docg3: don't set conflicting BCH_CONST_PARAMS option 2018-11-21 09:19:19 +01:00
lpddr mtd: lpddr: use mtd_device_register() 2018-07-24 07:50:22 +02:00
maps mtd: maps: gpio-addr-flash: Fix ioremapped size 2018-11-13 11:08:14 -08:00
nand mtd: rawnand: qcom: fix memory corruption that causes panic 2019-01-16 22:04:34 +01:00
parsers mtd: parsers: trx: add of_match_table with the new DT binding 2018-07-07 10:51:00 +02:00
spi-nor mtd: atmel-quadspi: disallow building on ebsa110 2019-01-09 17:38:37 +01:00
tests treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
ubi ubi: expose the volume CRC check skip flag 2018-08-15 00:25:21 +02:00
afs.c
ar7part.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
bcm47xxpart.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
bcm63xxpart.c
cmdlinepart.c mtd: cmdlinepart: Update comment for introduction of OFFSET_CONTINUOUS 2018-05-23 10:08:48 +02:00
ftl.c treewide: Use array_size() in vmalloc() 2018-06-12 16:19:22 -07:00
inftlcore.c
inftlmount.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
Kconfig mtd: Make Kconfig formatting consistent 2018-07-19 23:12:06 +02:00
Makefile mtd: Move onenand code base to drivers/mtd/nand/onenand 2018-03-15 15:40:37 +01:00
mtd_blkdevs.c mtd_blkdevs: handle highmem pages 2018-05-11 15:07:58 -06:00
mtdblock.c mtd: Unconditionally update ->fail_addr and ->addr in part_erase() 2018-03-15 18:22:26 +01:00
mtdblock_ro.c
mtdchar.c mtdchar: fix overflows in adjustment of count 2018-07-18 16:46:38 +02:00
mtdconcat.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
mtdcore.c mtd: Fallback to ->_read/write() when ->_read/write_oob() is missing 2018-07-18 16:44:03 +02:00
mtdcore.h mtd: move code adding (registering) partitions to the parse_mtd_partitions() 2018-05-07 10:10:47 +02:00
mtdoops.c treewide: Use array_size() in vmalloc() 2018-06-12 16:19:22 -07:00
mtdpart.c mtd: Make sure mtd->erasesize is valid even if the partition is of size 0 2019-02-15 08:10:10 +01:00
mtdsuper.c Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
mtdswap.c treewide: Use array_size() in vmalloc() 2018-06-12 16:19:22 -07:00
nftlcore.c
nftlmount.c mtd: nftl: remove redundant variable nb_erases 2018-07-07 10:55:05 +02:00
ofpart.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
redboot.c
rfd_ftl.c treewide: Use array_size() in vmalloc() 2018-06-12 16:19:22 -07:00
sm_ftl.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
sm_ftl.h mtd: Stop assuming mtd_erase() is asynchronous 2018-03-15 18:21:07 +01:00
ssfdc.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00