OSDN Git Service

mtd: spi-nor: fsl-quadspi: Don't let -EINVAL on the bus
authorAhmad Fatoum <a.fatoum@pengutronix.de>
Fri, 21 Sep 2018 09:32:53 +0000 (11:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2018 19:08:15 +0000 (11:08 -0800)
commit24177fabfef0960d53c8f5b3b7b349ad4a87bc9e
treeb17842489fcfb4985fd766c89781f1a8fb2806bf
parent55f15a247dab45542efa8ef5eb716b1f0e410376
mtd: spi-nor: fsl-quadspi: Don't let -EINVAL on the bus

commit 000412276370a9bcfec73b3752ceefd9a927f1db upstream.

fsl_qspi_get_seqid() may return -EINVAL, but fsl_qspi_init_ahb_read()
doesn't check for error codes with the result that -EINVAL could find
itself signalled over the bus.

In conjunction with the LS1046A SoC's A-009283 errata
("Illegal accesses to SPI flash memory can result in a system hang")
this illegal access to SPI flash memory results in a system hang
if userspace attempts reading later on.

Avoid this by always checking fsl_qspi_get_seqid()'s return value
and bail out otherwise.

Fixes: e46ecda764dc ("mtd: spi-nor: Add Freescale QuadSPI driver")
Cc: stable@vger.kernel.org
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/spi-nor/fsl-quadspi.c