linux-stable/drivers/mtd/nand
Evgeny Novikov a61698358b mtd: rawnand: intel: Fix potential buffer overflow in probe
[ Upstream commit 46a0dc10fb ]

ebu_nand_probe() read the value of u32 variable "cs" from the device
firmware description and used it as the index for array ebu_host->cs
that can contain MAX_CS (2) elements at most. That could result in
a buffer overflow and various bad consequences later.

Fix the potential buffer overflow by restricting values of "cs" with
MAX_CS in probe.

Found by Linux Driver Verification project (linuxtesting.org).

Fixes: 0b1039f016 ("mtd: rawnand: Add NAND controller support on Intel LGM SoC")
Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
Co-developed-by: Kirill Shilimanov <kirill.shilimanov@huawei.com>
Signed-off-by: Kirill Shilimanov <kirill.shilimanov@huawei.com>
Co-developed-by: Anton Vasilyev <vasilyev@ispras.ru>
Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210903082653.16441-1-novikov@ispras.ru
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-11-18 19:16:58 +01:00
..
onenand mtd: core: Constify buf in mtd_write_user_prot_reg() 2021-04-16 20:30:54 +02:00
raw mtd: rawnand: intel: Fix potential buffer overflow in probe 2021-11-18 19:16:58 +01:00
spi mtd: spinand: macronix: Add Quad support for serial NAND flash 2021-08-17 10:42:00 +02:00
bbt.c mtd: nand: bbt: Fix corner case in bad block table handling 2021-05-10 18:20:54 +02:00
core.c mtd: nand: Add helpers to manage ECC engines and configurations 2020-12-10 22:37:30 +01:00
ecc-sw-bch.c mtd: nand: ecc-bch: Use the public nsteps field 2021-03-11 09:37:28 +01:00
ecc-sw-hamming.c mtd: nand: ecc-hamming: Use the public nsteps field 2021-03-11 09:37:28 +01:00
ecc.c mtd: spinand: Allow the case where there is no ECC engine 2020-12-10 22:37:30 +01:00
Kconfig mtd: nand: Change dependency between the NAND and ECC cores 2020-12-10 22:37:32 +01:00
Makefile mtd: nand: ecc-hamming: Move Hamming code to the generic NAND layer 2020-12-10 22:37:29 +01:00