]> git.baikalelectronics.ru Git - kernel.git/commit
spi: bcm2835: bcm2835_spi_handle_err(): fix NULL pointer deref for non DMA transfers
authorMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 19 Jul 2022 07:22:35 +0000 (09:22 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 20 Jul 2022 13:03:40 +0000 (14:03 +0100)
commit4929a17f9b021b2fc736ba7d9fabc0ef1822fa80
tree54a3e19fbfdcd51783efbc64c39e5d11642e8bef
parent5eba10b6c2d336f8dbda5d1e733e67d3f1bdd252
spi: bcm2835: bcm2835_spi_handle_err(): fix NULL pointer deref for non DMA transfers

In case a IRQ based transfer times out the bcm2835_spi_handle_err()
function is called. Since commit d2ad94bb88af ("spi: bcm2835: Drop
dma_pending flag") the TX and RX DMA transfers are unconditionally
canceled, leading to NULL pointer derefs if ctlr->dma_tx or
ctlr->dma_rx are not set.

Fix the NULL pointer deref by checking that ctlr->dma_tx and
ctlr->dma_rx are valid pointers before accessing them.

Fixes: d2ad94bb88af ("spi: bcm2835: Drop dma_pending flag")
Cc: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Link: https://lore.kernel.org/r/20220719072234.2782764-1-mkl@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-bcm2835.c