]> 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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Jul 2022 15:14:16 +0000 (17:14 +0200)
commitc7070900c17f4a2c11415c3cd68c5111fc4460f6
treebda1c02aadfeb23f6729bb5620fec130c52b8bd4
parentd4c6f885042c0220de56dc16b8607ef96276e316
spi: bcm2835: bcm2835_spi_handle_err(): fix NULL pointer deref for non DMA transfers

commit 122131c0618f5f127e127cfd35a2d9a1d5a03d9e upstream.

In case a IRQ based transfer times out the bcm2835_spi_handle_err()
function is called. Since commit c3ad4e82d4ce ("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: c3ad4e82d4ce ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/spi/spi-bcm2835.c