From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-kernel@vger.kernel.org>, <linux-pci@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>
Cc: <catalin.marinas@arm.com>, <will.deacon@arm.com>,
<bhelgaas@google.com>, <gcherian@marvell.com>,
<guohanjun@huawei.com>, <yangyingliang@huawei.com>
Subject: [PATCH] arm64: PCI: fix memleak when calling pci_iomap/unmap()
Date: Sat, 5 Sep 2020 10:48:11 +0800 [thread overview]
Message-ID: <20200905024811.74701-1-yangyingliang@huawei.com> (raw)
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
next reply other threads:[~2020-09-05 2:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-05 2:48 Yang Yingliang [this message]
2020-09-07 10:45 ` Catalin Marinas
2020-09-07 10:51 ` George Cherian
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200905024811.74701-1-yangyingliang@huawei.com \
--to=yangyingliang@huawei.com \
--cc=bhelgaas@google.com \
--cc=catalin.marinas@arm.com \
--cc=gcherian@marvell.com \
--cc=guohanjun@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®