]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: cfi_cmdset_0002: fix crash when erasing/writing AMD cards
authorAndreas Persson <andreasp56@outlook.com>
Mon, 12 Jul 2021 07:54:52 +0000 (09:54 +0200)
committerSasha Levin <sashal@kernel.org>
Thu, 26 Aug 2021 12:36:12 +0000 (08:36 -0400)
commit10ab67cf78228899408e3c1e4f107f3d24d5dd5d
tree24a3000270dd54f0720a8ca5d33a8395b07f8569
parentf06b98c276782f5614227509bfa95eba8f587de8
mtd: cfi_cmdset_0002: fix crash when erasing/writing AMD cards

commit 2394e628738933aa014093d93093030f6232946d upstream.

Erasing an AMD linear flash card (AM29F016D) crashes after the first
sector has been erased. Likewise, writing to it crashes after two bytes
have been written. The reason is a missing check for a null pointer -
the cmdset_priv field is not set for this type of card.

Fixes: 6e5e551bf582 ("mtd: cfi_cmdset_0002: Add support for polling status register")
Signed-off-by: Andreas Persson <andreasp56@outlook.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/DB6P189MB05830B3530B8087476C5CFE4C1159@DB6P189MB0583.EURP189.PROD.OUTLOOK.COM
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/chips/cfi_cmdset_0002.c