spi: sprd: fix error pointer deref after DMA setup failure
Subsystems (3)
PATCH 1/1 spi: sprd: fix error pointer deref after DMA setup failure
The driver falls back to PIO mode if DMA setup fails during probe.
Make sure to check the dma.enabled flag before trying to release the DMA channels also on late probe errors to avoid dereferencing an error pointer (or attempting to release a channel a second time).
This issue was flagged by Sashiko when reviewing a devres allocation conversion patch.
---
Note that this one is based on 7.1-rc3 and will cause a trivial conflict with the devres allocation patch in spi/for-7.2 branch.
Let me know if your prefer a rebase on top of the conversion instead (which will result in a similar context conflict when backporting).
Johan
drivers/spi/spi-sprd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-sprd.c +2 -1
@@ -991,7 +991,8 @@ static int sprd_spi_probe(struct platform_device *pdev) disable_clk:clk_disable_unprepare (ss->clk); release_dma: -sprd_spi_dma_release (ss); +if (ss->dma.enable) +sprd_spi_dma_release (ss); free_controller:spi_controller_put (sctlr);
Signature · 1 line
2.53.0
Mark Brown
maintainerQuoted 1 line · Johan Hovold
spi: sprd: 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: sprd: fix error pointer deref after DMA setup failure
https://git.kernel.org/broonie/spi/c/3d67fffb7426
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