[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200905024811.74701-1-yangyingliang@huawei.com>
Date: Sat, 5 Sep 2020 10:48:11 +0800
From: Yang Yingliang <yangyingliang@...wei.com>
To: <linux-kernel@...r.kernel.org>, <linux-pci@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>
CC: <catalin.marinas@....com>, <will.deacon@....com>,
<bhelgaas@...gle.com>, <gcherian@...vell.com>,
<guohanjun@...wei.com>, <yangyingliang@...wei.com>
Subject: [PATCH] arm64: PCI: fix memleak when calling pci_iomap/unmap()
config GENERIC_IOMAP is disabled on arm64, so pci_iounmap() does
nothing, when we using pci_iomap/pci_iounmap(), it will lead to
memory leak. Implements pci_iounmap() for arm64 to fix this leak.
Fixes: 09a5723983e3 ("arm64: Use include/asm-generic/io.h")
Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
---
arch/arm64/include/asm/io.h | 5 +++++
arch/arm64/kernel/pci.c | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index ff50dd731852d..4d8da06ac295f 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -18,6 +18,11 @@
#include <asm/alternative.h>
#include <asm/cpufeature.h>
+#ifdef CONFIG_PCI
+struct pci_dev;
+#define pci_iounmap pci_iounmap
+extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr);
+#endif
/*
* Generic IO read/write. These perform native-endian accesses.
*/
diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
index 1006ed2d7c604..ddfa1c53def48 100644
--- a/arch/arm64/kernel/pci.c
+++ b/arch/arm64/kernel/pci.c
@@ -217,4 +217,9 @@ void pcibios_remove_bus(struct pci_bus *bus)
acpi_pci_remove_bus(bus);
}
+void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
+{
+ iounmap(addr);
+}
+EXPORT_SYMBOL(pci_iounmap);
#endif
--
2.25.1
Powered by blists - more mailing lists