* [PATCH] PCI: endpoint: Fix potential double free in __pci_epc_create
@ 2022-12-20 4:59 Miaoqian Lin
2023-04-08 9:30 ` Manivannan Sadhasivam
0 siblings, 1 reply; 2+ messages in thread
From: Miaoqian Lin @ 2022-12-20 4:59 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Kishon Vijay Abraham I, Bjorn Helgaas,
Yoshihiro Shimoda, linux-pci, linux-kernel
Cc: linmq006
When all references are dropped, callback function pci_epc_release()
for put_device() already call kfree(epc) to release memory.
Remove abundant kfree to fix double free.
Fixes: 7711cbb4862a ("PCI: endpoint: Fix WARN() when an endpoint driver is removed")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/pci/endpoint/pci-epc-core.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
index 2542196e8c3d..7dc640c99d9a 100644
--- a/drivers/pci/endpoint/pci-epc-core.c
+++ b/drivers/pci/endpoint/pci-epc-core.c
@@ -800,8 +800,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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI: endpoint: Fix potential double free in __pci_epc_create
2022-12-20 4:59 [PATCH] PCI: endpoint: Fix potential double free in __pci_epc_create Miaoqian Lin
@ 2023-04-08 9:30 ` Manivannan Sadhasivam
0 siblings, 0 replies; 2+ messages in thread
From: Manivannan Sadhasivam @ 2023-04-08 9:30 UTC (permalink / raw)
To: Miaoqian Lin
Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
Kishon Vijay Abraham I, Bjorn Helgaas, Yoshihiro Shimoda,
linux-pci, linux-kernel
On Tue, Dec 20, 2022 at 08:59:29AM +0400, Miaoqian Lin wrote:
> When all references are dropped, callback function pci_epc_release()
> for put_device() already call kfree(epc) to release memory.
> Remove abundant kfree to fix double free.
>
> Fixes: 7711cbb4862a ("PCI: endpoint: Fix WARN() when an endpoint driver is removed")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
- Mani
> ---
> drivers/pci/endpoint/pci-epc-core.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
> index 2542196e8c3d..7dc640c99d9a 100644
> --- a/drivers/pci/endpoint/pci-epc-core.c
> +++ b/drivers/pci/endpoint/pci-epc-core.c
> @@ -800,8 +800,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
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-08 9:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-20 4:59 [PATCH] PCI: endpoint: Fix potential double free in __pci_epc_create Miaoqian Lin
2023-04-08 9:30 ` Manivannan Sadhasivam
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).