Skip to contentSkip to conversation

spi: qup: fix error pointer deref after DMA setup failure

PATCH In review Johan Hovold 2 participants 2 messages May 12 – May 19

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: qup: fix error pointer deref after DMA setup failure

The driver falls back to PIO mode if DMA setup fails during probe.

Make sure to the clear the DMA channel pointers on setup failure to avoid dereferencing an error pointer (or attempting to release a channel a second time) on later probe errors or driver unbind.

This issue was flagged by Sashiko when reviewing a devres allocation conversion patch.

---
 drivers/spi/spi-qup.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/spi/spi-qup.c +3 -0
index 45d9b4cb75e4..50bb7701b9d5 100644
@@ -996,8 +996,11 @@ static int spi_qup_init_dma(struct spi_controller *host, resource_size_t base)
 
 err:
 	dma_release_channel(host->dma_tx);
+	host->dma_tx = NULL;
 err_tx:
 	dma_release_channel(host->dma_rx);
+	host->dma_rx = NULL;
+
 	return ret;
 }
 
Signature · 1 line
2.53.0
maintainer
#1 lore raw
Quoted 1 line · Johan Hovold

spi: qup: fix error pointer deref after DMA setup failure

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.1

Thanks!

[1/1] spi: qup: fix error pointer deref after DMA setup failure

      https://git.kernel.org/broonie/spi/c/a7e8f3efd50a

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark