lkml.org 
[lkml]   [2020]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] arm64: PCI: fix memleak when calling pci_iomap/unmap()
Date


> -----Original Message-----
> From: Catalin Marinas <catalin.marinas@arm.com>
> Sent: Monday, September 7, 2020 4:16 PM
> To: Yang Yingliang <yangyingliang@huawei.com>
> Cc: linux-kernel@vger.kernel.org; linux-pci@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org; will.deacon@arm.com; bhelgaas@google.com;
> George Cherian <gcherian@marvell.com>; guohanjun@huawei.com
> Subject: Re: [PATCH] arm64: PCI: fix memleak when calling
> pci_iomap/unmap()
>
>
> ----------------------------------------------------------------------
> On Sat, Sep 05, 2020 at 10:48:11AM +0800, Yang Yingliang wrote:
> > 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);
>
> So, what's wrong with the generic pci_iounmap() implementation?
> Shouldn't it call iounmap() already?
Since ARM64 selects CONFIG_GENERIC_PCI_IOMAP and not
CONFIG_GENERIC_IOMAP, the pci_iounmap function is reduced to a NULL
function. Due to this, even the managed release variants or even the explicit
pci_iounmap calls doesn't really remove the mappings leading to leak.

-George
https://lkml.org/lkml/2020/8/20/28

>
> --
> Catalin

\
 
 \ /
  Last update: 2020-09-07 12:51    [W:0.075 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site