Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1620312 > unrolled thread
| Started by | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| First post | 2017-04-10 19:00 +0200 |
| Last post | 2017-04-10 19:00 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 4.10 083/110] PCI: xgene: Fix double free on init error Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-10 19:00 +0200
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Date | 2017-04-10 19:00 +0200 |
| Subject | [PATCH 4.10 083/110] PCI: xgene: Fix double free on init error |
| Message-ID | <tuKPv-3hW-7@gated-at.bofh.it> |
4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <dan.carpenter@oracle.com>
[ Upstream commit 1ded56df3247d358390ae6dc09ccee620262ac5f ]
The "port" variable was allocated with devm_kzalloc() so if we free it with
kfree() it will be freed twice. Also I changed it to propogate the error
from devm_ioremap_resource() instead of returning -ENOMEM.
Fixes: c5d460396100 ("PCI: Add MCFG quirks for X-Gene host controller")
Also-posted-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Tanmay Inamdar <tinamdar@apm.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/pci/host/pci-xgene.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -246,14 +246,11 @@ static int xgene_pcie_ecam_init(struct p
ret = xgene_get_csr_resource(adev, &csr);
if (ret) {
dev_err(dev, "can't get CSR resource\n");
- kfree(port);
return ret;
}
port->csr_base = devm_ioremap_resource(dev, &csr);
- if (IS_ERR(port->csr_base)) {
- kfree(port);
- return -ENOMEM;
- }
+ if (IS_ERR(port->csr_base))
+ return PTR_ERR(port->csr_base);
port->cfg_base = cfg->win;
port->version = ipversion;
Back to top | Article view | linux.kernel
csiph-web