From: Pali Rohár Date: Wed, 4 May 2022 16:57:33 +0000 (+0200) Subject: PCI: aardvark: Fix memory leak in driver unbind X-Git-Tag: v5.15.73~4403 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af27f54e62243a6609c8e21c98b4e7eed4cde992;p=platform%2Fkernel%2Flinux-rpi.git PCI: aardvark: Fix memory leak in driver unbind commit 2f040a17f5061457ae95035326d3159eddc1e5cc upstream. Free config space for emulated root bridge when unbinding driver to fix memory leak. Do it after disabling and masking all interrupts, since aardvark interrupt handler accesses config space of emulated root bridge. Link: https://lore.kernel.org/r/20211130172913.9727-9-kabel@kernel.org Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Signed-off-by: Lorenzo Pieralisi Signed-off-by: Marek Behún Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c index d2c01c6..02eefc1 100644 --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -1718,6 +1718,9 @@ static int advk_pcie_remove(struct platform_device *pdev) advk_pcie_remove_msi_irq_domain(pcie); advk_pcie_remove_irq_domain(pcie); + /* Free config space for emulated root bridge */ + pci_bridge_emul_cleanup(&pcie->bridge); + /* Disable outbound address windows mapping */ for (i = 0; i < OB_WIN_COUNT; i++) advk_pcie_disable_ob_win(pcie, i);