Skip to content

Commit d79e921

Browse files
jhovoldgregkh
authored andcommitted
spi: topcliff-pch: fix use-after-free on unbind
commit 9d72732 upstream. Give the driver a chance to flush its queue before releasing the DMA buffers on driver unbind Fixes: c37f3c2 ("spi/topcliff_pch: DMA support") Cc: stable@vger.kernel.org # 3.1 Cc: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260414134319.978196-9-johan@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5f08cbd commit d79e921

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/spi/spi-topcliff-pch.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,9 +1406,6 @@ static void pch_spi_pd_remove(struct platform_device *plat_dev)
14061406
dev_dbg(&plat_dev->dev, "%s:[ch%d] irq=%d\n",
14071407
__func__, plat_dev->id, board_dat->pdev->irq);
14081408

1409-
if (use_dma)
1410-
pch_free_dma_buf(board_dat, data);
1411-
14121409
/* check for any pending messages; no action is taken if the queue
14131410
* is still full; but at least we tried. Unload anyway */
14141411
count = 500;
@@ -1432,6 +1429,9 @@ static void pch_spi_pd_remove(struct platform_device *plat_dev)
14321429
free_irq(board_dat->pdev->irq, data);
14331430
}
14341431

1432+
if (use_dma)
1433+
pch_free_dma_buf(board_dat, data);
1434+
14351435
pci_iounmap(board_dat->pdev, data->io_remap_addr);
14361436
spi_unregister_master(data->master);
14371437
}

0 commit comments

Comments
 (0)