Commit e862a0b
committed
spi: bcm2835: bcm2835_spi_handle_err(): fix NULL pointer deref for non DMA transfers
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2071848
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2122415
commit 4ceaa68
Author: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Tue, 19 Jul 2022 09:22:35 +0200
In case a IRQ based transfer times out the bcm2835_spi_handle_err()
function is called. Since commit 1513cee ("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: 1513cee ("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: Mark Salter <msalter@redhat.com>1 parent e3a3777 commit e862a0b
1 file changed
+8
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1138 | 1138 | | |
1139 | 1139 | | |
1140 | 1140 | | |
1141 | | - | |
1142 | | - | |
1143 | | - | |
1144 | | - | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
1145 | 1149 | | |
1146 | 1150 | | |
1147 | 1151 | | |
| |||
0 commit comments