Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] PCI: endpoint: Fix double free in __pci_epc_create()
@ 2023-10-25 11:57 Dan Carpenter
  2023-10-25 17:05 ` Manivannan Sadhasivam
  2023-10-26 16:13 ` Bjorn Helgaas
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2023-10-25 11:57 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Kishon Vijay Abraham I, Bjorn Helgaas,
	linux-pci, kernel-janitors

The pci_epc_release() function frees "epc" so the kfree() on the next
line is a double free.

Fixes: 7711cbb4862a ("PCI: endpoint: Fix WARN() when an endpoint driver is removed")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 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 fe421d46a8a4..56e1184bc6c2 100644
--- a/drivers/pci/endpoint/pci-epc-core.c
+++ b/drivers/pci/endpoint/pci-epc-core.c
@@ -869,7 +869,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.42.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: endpoint: Fix double free in __pci_epc_create()
  2023-10-25 11:57 [PATCH] PCI: endpoint: Fix double free in __pci_epc_create() Dan Carpenter
@ 2023-10-25 17:05 ` Manivannan Sadhasivam
  2023-10-26 16:13 ` Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Manivannan Sadhasivam @ 2023-10-25 17:05 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Yoshihiro Shimoda, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Kishon Vijay Abraham I, Bjorn Helgaas, linux-pci, kernel-janitors

On Wed, Oct 25, 2023 at 02:57:23PM +0300, Dan Carpenter wrote:
> The pci_epc_release() function frees "epc" so the kfree() on the next
> line is a double free.
> 
> Fixes: 7711cbb4862a ("PCI: endpoint: Fix WARN() when an endpoint driver is removed")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

- Mani

> ---
>  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 fe421d46a8a4..56e1184bc6c2 100644
> --- a/drivers/pci/endpoint/pci-epc-core.c
> +++ b/drivers/pci/endpoint/pci-epc-core.c
> @@ -869,7 +869,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.42.0
> 

-- 
மணிவண்ணன் சதாசிவம்

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: endpoint: Fix double free in __pci_epc_create()
  2023-10-25 11:57 [PATCH] PCI: endpoint: Fix double free in __pci_epc_create() Dan Carpenter
  2023-10-25 17:05 ` Manivannan Sadhasivam
@ 2023-10-26 16:13 ` Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2023-10-26 16:13 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Yoshihiro Shimoda, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Kishon Vijay Abraham I, Bjorn Helgaas,
	linux-pci, kernel-janitors

On Wed, Oct 25, 2023 at 02:57:23PM +0300, Dan Carpenter wrote:
> The pci_epc_release() function frees "epc" so the kfree() on the next
> line is a double free.
> 
> Fixes: 7711cbb4862a ("PCI: endpoint: Fix WARN() when an endpoint driver is removed")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Applied with Manivannan's reviewed-by to pci/misc for v6.7, thanks!

> ---
>  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 fe421d46a8a4..56e1184bc6c2 100644
> --- a/drivers/pci/endpoint/pci-epc-core.c
> +++ b/drivers/pci/endpoint/pci-epc-core.c
> @@ -869,7 +869,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.42.0
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-26 16:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-25 11:57 [PATCH] PCI: endpoint: Fix double free in __pci_epc_create() Dan Carpenter
2023-10-25 17:05 ` Manivannan Sadhasivam
2023-10-26 16:13 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox