]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
mtd: rawnand: fsl_upm: Fix an off-by one test in fun_exec_op()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Wed, 19 Jul 2023 21:55:01 +0000 (23:55 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 30 Oct 2023 10:59:58 +0000 (11:59 +0100)
commit0b30cdbee5a99736c342afda918307a661074c2f
tree3ba0981feccc04112929a4ea3c86fd4f28a74f49
parent7c1181c409de61b0dcf05644f8da174ddc374dfb
mtd: rawnand: fsl_upm: Fix an off-by one test in fun_exec_op()

BugLink: https://bugs.launchpad.net/bugs/2038236
[ Upstream commit c6abce60338aa2080973cd95be0aedad528bb41f ]

'op-cs' is copied in 'fun->mchip_number' which is used to access the
'mchip_offsets' and the 'rnb_gpio' arrays.
These arrays have NAND_MAX_CHIPS elements, so the index must be below this
limit.

Fix the sanity check in order to avoid the NAND_MAX_CHIPS value. This
would lead to out-of-bound accesses.

Fixes: 54309d657767 ("mtd: rawnand: fsl_upm: Implement exec_op()")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/cd01cba1c7eda58bdabaae174c78c067325803d2.1689803636.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/mtd/nand/raw/fsl_upm.c