* [PATCH v2 0/2] PCI: rcar-pcie: Fix memory leak
@ 2017-08-04 3:32 Harunobu Kurokawa
2017-08-04 3:32 ` [PATCH v2 1/2] PCI: rcar: Fix error exit path Harunobu Kurokawa
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Harunobu Kurokawa @ 2017-08-04 3:32 UTC (permalink / raw)
To: horms, bhelgaas, linux-pci
Cc: linux-renesas-soc, linux-kernel, Harunobu Kurokawa
When no PCIe card is inserted, there is a memory leak as
pci_free_resource_list is not called before returning.
v2:
separate the patch to two files.
Harunobu Kurokawa (1):
PCI: rcar-pcie: Fix memory leak when no PCIe card is inserted
Lorenzo Pieralisi (1):
PCI: rcar: Fix error exit path
drivers/pci/host/pcie-rcar.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--
2.9.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] PCI: rcar: Fix error exit path
2017-08-04 3:32 [PATCH v2 0/2] PCI: rcar-pcie: Fix memory leak Harunobu Kurokawa
@ 2017-08-04 3:32 ` Harunobu Kurokawa
2017-08-04 3:32 ` [PATCH v2 2/2] PCI: rcar-pcie: Fix memory leak when no PCIe card is inserted Harunobu Kurokawa
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Harunobu Kurokawa @ 2017-08-04 3:32 UTC (permalink / raw)
To: horms, bhelgaas, linux-pci
Cc: linux-renesas-soc, linux-kernel, Lorenzo Pieralisi, Harunobu Kurokawa
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Commit 90634e854079 ("PCI: rcar: Convert PCI scan API to
pci_scan_root_bus_bridge()") converted PCI root bus scan API
to the new pci_scan_root_bus_bridge() API; in the process
some error paths were not updated correctly which may cause
memory leaks.
Fix the driver error exit path reinstating the previous correct
error exit behaviour.
Fixes: 90634e854079 ("PCI: rcar: Convert PCI scan API to pci_scan_root_bus_bridge()")
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Harunobu Kurokawa <harunobu.kurokawa.dn@renesas.com>
---
drivers/pci/host/pcie-rcar.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index ac80fbb..6b73981 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -471,10 +471,8 @@ static int rcar_pcie_enable(struct rcar_pcie *pcie)
bridge->msi = &pcie->msi.chip;
ret = pci_scan_root_bus_bridge(bridge);
- if (ret < 0) {
- kfree(bridge);
+ if (ret < 0)
return ret;
- }
bus = bridge->bus;
@@ -1190,14 +1188,15 @@ static int rcar_pcie_probe(struct platform_device *pdev)
return 0;
-err_free_bridge:
- pci_free_host_bridge(bridge);
-
err_pm_put:
pm_runtime_put(dev);
err_pm_disable:
pm_runtime_disable(dev);
+
+err_free_bridge:
+ pci_free_host_bridge(bridge);
+
return err;
}
--
2.9.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] PCI: rcar-pcie: Fix memory leak when no PCIe card is inserted
2017-08-04 3:32 [PATCH v2 0/2] PCI: rcar-pcie: Fix memory leak Harunobu Kurokawa
2017-08-04 3:32 ` [PATCH v2 1/2] PCI: rcar: Fix error exit path Harunobu Kurokawa
@ 2017-08-04 3:32 ` Harunobu Kurokawa
2017-08-14 21:11 ` [PATCH v2 0/2] PCI: rcar-pcie: Fix memory leak Bjorn Helgaas
2017-08-15 22:53 ` Bjorn Helgaas
3 siblings, 0 replies; 6+ messages in thread
From: Harunobu Kurokawa @ 2017-08-04 3:32 UTC (permalink / raw)
To: horms, bhelgaas, linux-pci
Cc: linux-renesas-soc, linux-kernel, Harunobu Kurokawa
When no PCIe card is inserted, there is a memory leak as
pci_free_resource_list is not called before returning.
Signed-off-by: Harunobu Kurokawa <harunobu.kurokawa.dn@renesas.com>
---
drivers/pci/host/pcie-rcar.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index 6b73981..70b487c 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -1196,6 +1196,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)
err_free_bridge:
pci_free_host_bridge(bridge);
+ pci_free_resource_list(&pcie->resources);
return err;
}
--
2.9.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] PCI: rcar-pcie: Fix memory leak
2017-08-04 3:32 [PATCH v2 0/2] PCI: rcar-pcie: Fix memory leak Harunobu Kurokawa
2017-08-04 3:32 ` [PATCH v2 1/2] PCI: rcar: Fix error exit path Harunobu Kurokawa
2017-08-04 3:32 ` [PATCH v2 2/2] PCI: rcar-pcie: Fix memory leak when no PCIe card is inserted Harunobu Kurokawa
@ 2017-08-14 21:11 ` Bjorn Helgaas
2017-08-15 15:56 ` Simon Horman
2017-08-15 22:53 ` Bjorn Helgaas
3 siblings, 1 reply; 6+ messages in thread
From: Bjorn Helgaas @ 2017-08-14 21:11 UTC (permalink / raw)
To: Harunobu Kurokawa
Cc: horms, bhelgaas, linux-pci, linux-renesas-soc, linux-kernel
On Fri, Aug 04, 2017 at 12:32:53PM +0900, Harunobu Kurokawa wrote:
> When no PCIe card is inserted, there is a memory leak as
> pci_free_resource_list is not called before returning.
>
> v2:
> separate the patch to two files.
>
> Harunobu Kurokawa (1):
> PCI: rcar-pcie: Fix memory leak when no PCIe card is inserted
>
> Lorenzo Pieralisi (1):
> PCI: rcar: Fix error exit path
>
> drivers/pci/host/pcie-rcar.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
Waiting for Simon's ack...
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] PCI: rcar-pcie: Fix memory leak
2017-08-14 21:11 ` [PATCH v2 0/2] PCI: rcar-pcie: Fix memory leak Bjorn Helgaas
@ 2017-08-15 15:56 ` Simon Horman
0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2017-08-15 15:56 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Harunobu Kurokawa, bhelgaas, linux-pci, linux-renesas-soc, linux-kernel
On Mon, Aug 14, 2017 at 04:11:14PM -0500, Bjorn Helgaas wrote:
> On Fri, Aug 04, 2017 at 12:32:53PM +0900, Harunobu Kurokawa wrote:
> > When no PCIe card is inserted, there is a memory leak as
> > pci_free_resource_list is not called before returning.
> >
> > v2:
> > separate the patch to two files.
> >
> > Harunobu Kurokawa (1):
> > PCI: rcar-pcie: Fix memory leak when no PCIe card is inserted
> >
> > Lorenzo Pieralisi (1):
> > PCI: rcar: Fix error exit path
> >
> > drivers/pci/host/pcie-rcar.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
>
> Waiting for Simon's ack...
Acked-by: Simon Horman <horms+renesas@verge.net.au>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] PCI: rcar-pcie: Fix memory leak
2017-08-04 3:32 [PATCH v2 0/2] PCI: rcar-pcie: Fix memory leak Harunobu Kurokawa
` (2 preceding siblings ...)
2017-08-14 21:11 ` [PATCH v2 0/2] PCI: rcar-pcie: Fix memory leak Bjorn Helgaas
@ 2017-08-15 22:53 ` Bjorn Helgaas
3 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2017-08-15 22:53 UTC (permalink / raw)
To: Harunobu Kurokawa
Cc: horms, bhelgaas, linux-pci, linux-renesas-soc, linux-kernel
On Fri, Aug 04, 2017 at 12:32:53PM +0900, Harunobu Kurokawa wrote:
> When no PCIe card is inserted, there is a memory leak as
> pci_free_resource_list is not called before returning.
>
> v2:
> separate the patch to two files.
>
> Harunobu Kurokawa (1):
> PCI: rcar-pcie: Fix memory leak when no PCIe card is inserted
>
> Lorenzo Pieralisi (1):
> PCI: rcar: Fix error exit path
>
> drivers/pci/host/pcie-rcar.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
Applied with Simon's ack to pci/host-rcar for v4.14, thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-08-15 22:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-04 3:32 [PATCH v2 0/2] PCI: rcar-pcie: Fix memory leak Harunobu Kurokawa
2017-08-04 3:32 ` [PATCH v2 1/2] PCI: rcar: Fix error exit path Harunobu Kurokawa
2017-08-04 3:32 ` [PATCH v2 2/2] PCI: rcar-pcie: Fix memory leak when no PCIe card is inserted Harunobu Kurokawa
2017-08-14 21:11 ` [PATCH v2 0/2] PCI: rcar-pcie: Fix memory leak Bjorn Helgaas
2017-08-15 15:56 ` Simon Horman
2017-08-15 22:53 ` Bjorn Helgaas
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).