mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
dmaengine: switchtec-dma: fix use-after-free of swdma_dev in remove()
dma_async_device_unregister() can drop the last reference on dma_dev and free swdma_dev synchronously via switchtec_dma_release(), but switchtec_dma_remove() then uses swdma_dev->bar for iounmap(). Cache bar in a local variable before the unregister call. Reported-by: Sashiko <sashiko-bot@kernel.org> Link: https://lore.kernel.org/dmaengine/20260717223431.625EE1F000E9@smtp.kernel.org Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Link: https://patch.msgid.link/20260902062153.31048-8-logang@deltatee.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
5b4c561554
commit
9f744689c4
|
|
@ -1380,6 +1380,7 @@ static int switchtec_dma_probe(struct pci_dev *pdev,
|
|||
static void switchtec_dma_remove(struct pci_dev *pdev)
|
||||
{
|
||||
struct switchtec_dma_dev *swdma_dev = pci_get_drvdata(pdev);
|
||||
void __iomem *bar = swdma_dev->bar;
|
||||
|
||||
switchtec_dma_chans_release(pdev, swdma_dev);
|
||||
|
||||
|
|
@ -1392,7 +1393,7 @@ static void switchtec_dma_remove(struct pci_dev *pdev)
|
|||
|
||||
dma_async_device_unregister(&swdma_dev->dma_dev);
|
||||
|
||||
iounmap(swdma_dev->bar);
|
||||
iounmap(bar);
|
||||
pci_release_mem_regions(pdev);
|
||||
pci_disable_device(pdev);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user