mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
spi: ti-qspi: fix use-after-free after DMA setup failure
commitea6ec3343eupstream. The driver falls back to PIO mode if DMA setup fails during probe. Make sure to clear the DMA channel pointer also if buffer allocation fails to avoid passing a pointer to the released channel to the DMA engine (or trying to free the channel a second time on late probe errors or driver unbind). This issue was flagged by Sashiko when reviewing a devres allocation conversion patch. Fixes:c687c46e9e("spi: spi-ti-qspi: Use bounce buffer if read buffer is not DMA'ble") Link: https://sashiko.dev/#/patchset/20260505072909.618363-1-johan%40kernel.org?part=17 Cc: stable@vger.kernel.org # 4.12 Cc: Vignesh R <vigneshr@ti.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260512074809.915084-1-johan@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
450c319dd0
commit
f2dc841d7d
@@ -874,6 +874,7 @@ static int ti_qspi_probe(struct platform_device *pdev)
|
||||
dev_err(qspi->dev,
|
||||
"dma_alloc_coherent failed, using PIO mode\n");
|
||||
dma_release_channel(qspi->rx_chan);
|
||||
qspi->rx_chan = NULL;
|
||||
goto no_dma;
|
||||
}
|
||||
host->dma_rx = qspi->rx_chan;
|
||||
|
||||
Reference in New Issue
Block a user