[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250102093058.177866-1-make_ruc2021@163.com>
Date: Thu, 2 Jan 2025 17:30:58 +0800
From: Ma Ke <make_ruc2021@....com>
To: lpieralisi@...nel.org,
kw@...ux.com,
mani@...nel.org,
kishon@...nel.org,
bhelgaas@...gle.com,
jpinto@...opsys.com
Cc: linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org,
Ma Ke <make_ruc2021@....com>,
stable@...r.kernel.org
Subject: [PATCH] PCI: endpoint: Fix a double free in __pci_epc_create()
The put_device(&epc->dev) call will trigger pci_epc_release() which
frees "epc" so the kfree(epc) on the next line is a double free.
Found by code review.
Cc: stable@...r.kernel.org
Fixes: 5e8cb4033807 ("PCI: endpoint: Add EP core layer to enable EP controller and EP functions")
Signed-off-by: Ma Ke <make_ruc2021@....com>
---
drivers/pci/endpoint/pci-epc-core.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
index 46c9a5c3ca14..652350f054cf 100644
--- a/drivers/pci/endpoint/pci-epc-core.c
+++ b/drivers/pci/endpoint/pci-epc-core.c
@@ -818,7 +818,6 @@ __pci_epc_create(struct device *dev, const struct pci_epc_ops *ops,
put_dev:
put_device(&epc->dev);
- kfree(epc);
err_ret:
return ERR_PTR(ret);
--
2.25.1
Powered by blists - more mailing lists