linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: PCI: fix memleak when calling pci_iomap/unmap()
@ 2020-09-05  2:48 Yang Yingliang
  2020-09-07 10:45 ` Catalin Marinas
  0 siblings, 1 reply; 7+ messages in thread
From: Yang Yingliang @ 2020-09-05  2:48 UTC (permalink / raw)
  To: linux-kernel, linux-pci, linux-arm-kernel
  Cc: catalin.marinas, guohanjun, will.deacon, gcherian, yangyingliang,
	bhelgaas

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@huawei.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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-09-11  9:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-05  2:48 [PATCH] arm64: PCI: fix memleak when calling pci_iomap/unmap() Yang Yingliang
2020-09-07 10:45 ` Catalin Marinas
     [not found]   ` <BYAPR18MB267959E6FE4BEF38D0A4611EC5280@BYAPR18MB2679.namprd18.prod.outlook.com>
2020-09-07 11:21     ` Catalin Marinas
2020-09-09 11:36       ` Lorenzo Pieralisi
2020-09-09 13:54         ` Catalin Marinas
2020-09-09 17:37           ` Lorenzo Pieralisi
2020-09-11  9:51           ` Lorenzo Pieralisi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).