All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] NTB: Drop kfree for memory allocated with devm_kzalloc
@ 2021-02-10  7:53 ` Wei Yongjun
  0 siblings, 0 replies; 5+ messages in thread
From: Wei Yongjun @ 2021-02-10  7:53 UTC (permalink / raw)
  To: Hulk Robot, Jon Mason, Dave Jiang, Allen Hubbe,
	Lorenzo Pieralisi, Kishon Vijay Abraham I
  Cc: Wei Yongjun, linux-ntb, linux-kernel

It's not necessary to free memory allocated with devm_kzalloc
and using kfree leads to a double free.

Fixes: 363baf7d6051 ("NTB: Add support for EPF PCI-Express Non-Transparent Bridge")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/ntb/hw/epf/ntb_hw_epf.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/ntb/hw/epf/ntb_hw_epf.c b/drivers/ntb/hw/epf/ntb_hw_epf.c
index 2cccb7dff5dd..b019755e4e21 100644
--- a/drivers/ntb/hw/epf/ntb_hw_epf.c
+++ b/drivers/ntb/hw/epf/ntb_hw_epf.c
@@ -723,7 +723,6 @@ static void ntb_epf_pci_remove(struct pci_dev *pdev)
 	ntb_unregister_device(&ndev->ntb);
 	ntb_epf_cleanup_isr(ndev);
 	ntb_epf_deinit_pci(ndev);
-	kfree(ndev);
 }
 
 static const struct ntb_epf_data j721e_data = {


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

* [PATCH -next] NTB: Drop kfree for memory allocated with devm_kzalloc
@ 2021-02-10  7:53 ` Wei Yongjun
  0 siblings, 0 replies; 5+ messages in thread
From: Wei Yongjun @ 2021-02-10  7:53 UTC (permalink / raw)
  To: Hulk Robot, Jon Mason, Dave Jiang, Allen Hubbe,
	Lorenzo Pieralisi, Kishon Vijay Abraham I
  Cc: Wei Yongjun, linux-ntb, linux-kernel

It's not necessary to free memory allocated with devm_kzalloc
and using kfree leads to a double free.

Fixes: 363baf7d6051 ("NTB: Add support for EPF PCI-Express Non-Transparent Bridge")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/ntb/hw/epf/ntb_hw_epf.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/ntb/hw/epf/ntb_hw_epf.c b/drivers/ntb/hw/epf/ntb_hw_epf.c
index 2cccb7dff5dd..b019755e4e21 100644
--- a/drivers/ntb/hw/epf/ntb_hw_epf.c
+++ b/drivers/ntb/hw/epf/ntb_hw_epf.c
@@ -723,7 +723,6 @@ static void ntb_epf_pci_remove(struct pci_dev *pdev)
 	ntb_unregister_device(&ndev->ntb);
 	ntb_epf_cleanup_isr(ndev);
 	ntb_epf_deinit_pci(ndev);
-	kfree(ndev);
 }
 
 static const struct ntb_epf_data j721e_data = {


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

* Re: [PATCH -next] NTB: Drop kfree for memory allocated with devm_kzalloc
  2021-02-10  7:53 ` Wei Yongjun
@ 2021-02-12 12:48   ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 5+ messages in thread
From: Kishon Vijay Abraham I @ 2021-02-12 12:48 UTC (permalink / raw)
  To: Wei Yongjun, Hulk Robot, Jon Mason, Dave Jiang, Allen Hubbe,
	Lorenzo Pieralisi
  Cc: linux-ntb, linux-kernel, Kishon Vijay Abraham I



On 10/02/21 1:23 pm, Wei Yongjun wrote:
> It's not necessary to free memory allocated with devm_kzalloc
> and using kfree leads to a double free.
> 
> Fixes: 363baf7d6051 ("NTB: Add support for EPF PCI-Express Non-Transparent Bridge")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/ntb/hw/epf/ntb_hw_epf.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/ntb/hw/epf/ntb_hw_epf.c b/drivers/ntb/hw/epf/ntb_hw_epf.c
> index 2cccb7dff5dd..b019755e4e21 100644
> --- a/drivers/ntb/hw/epf/ntb_hw_epf.c
> +++ b/drivers/ntb/hw/epf/ntb_hw_epf.c
> @@ -723,7 +723,6 @@ static void ntb_epf_pci_remove(struct pci_dev *pdev)
>  	ntb_unregister_device(&ndev->ntb);
>  	ntb_epf_cleanup_isr(ndev);
>  	ntb_epf_deinit_pci(ndev);
> -	kfree(ndev);
>  }

Reviewed-by: Kishon Vijay Abraham I <kishon@ti.com>
>  
>  static const struct ntb_epf_data j721e_data = {
> 

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

* Re: [PATCH -next] NTB: Drop kfree for memory allocated with devm_kzalloc
@ 2021-02-12 12:48   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 5+ messages in thread
From: Kishon Vijay Abraham I @ 2021-02-12 12:48 UTC (permalink / raw)
  To: Wei Yongjun, Hulk Robot, Jon Mason, Dave Jiang, Allen Hubbe,
	Lorenzo Pieralisi
  Cc: linux-ntb, linux-kernel, Kishon Vijay Abraham I



On 10/02/21 1:23 pm, Wei Yongjun wrote:
> It's not necessary to free memory allocated with devm_kzalloc
> and using kfree leads to a double free.
> 
> Fixes: 363baf7d6051 ("NTB: Add support for EPF PCI-Express Non-Transparent Bridge")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/ntb/hw/epf/ntb_hw_epf.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/ntb/hw/epf/ntb_hw_epf.c b/drivers/ntb/hw/epf/ntb_hw_epf.c
> index 2cccb7dff5dd..b019755e4e21 100644
> --- a/drivers/ntb/hw/epf/ntb_hw_epf.c
> +++ b/drivers/ntb/hw/epf/ntb_hw_epf.c
> @@ -723,7 +723,6 @@ static void ntb_epf_pci_remove(struct pci_dev *pdev)
>  	ntb_unregister_device(&ndev->ntb);
>  	ntb_epf_cleanup_isr(ndev);
>  	ntb_epf_deinit_pci(ndev);
> -	kfree(ndev);
>  }

Reviewed-by: Kishon Vijay Abraham I <kishon@ti.com>
>  
>  static const struct ntb_epf_data j721e_data = {
> 

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

* Re: [PATCH -next] NTB: Drop kfree for memory allocated with devm_kzalloc
  2021-02-10  7:53 ` Wei Yongjun
  (?)
  (?)
@ 2021-02-12 17:45 ` Lorenzo Pieralisi
  -1 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Pieralisi @ 2021-02-12 17:45 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Hulk Robot, Jon Mason, Dave Jiang, Allen Hubbe,
	Kishon Vijay Abraham I, linux-ntb, linux-kernel

On Wed, Feb 10, 2021 at 07:53:45AM +0000, Wei Yongjun wrote:
> It's not necessary to free memory allocated with devm_kzalloc
> and using kfree leads to a double free.
> 
> Fixes: 363baf7d6051 ("NTB: Add support for EPF PCI-Express Non-Transparent Bridge")

Squashed it in the commit it is fixing and repushed pci/ntb out.

Thanks,
Lorenzo

> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/ntb/hw/epf/ntb_hw_epf.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/ntb/hw/epf/ntb_hw_epf.c b/drivers/ntb/hw/epf/ntb_hw_epf.c
> index 2cccb7dff5dd..b019755e4e21 100644
> --- a/drivers/ntb/hw/epf/ntb_hw_epf.c
> +++ b/drivers/ntb/hw/epf/ntb_hw_epf.c
> @@ -723,7 +723,6 @@ static void ntb_epf_pci_remove(struct pci_dev *pdev)
>  	ntb_unregister_device(&ndev->ntb);
>  	ntb_epf_cleanup_isr(ndev);
>  	ntb_epf_deinit_pci(ndev);
> -	kfree(ndev);
>  }
>  
>  static const struct ntb_epf_data j721e_data = {
> 

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

end of thread, other threads:[~2021-02-12 17:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10  7:53 [PATCH -next] NTB: Drop kfree for memory allocated with devm_kzalloc Wei Yongjun
2021-02-10  7:53 ` Wei Yongjun
2021-02-12 12:48 ` Kishon Vijay Abraham I
2021-02-12 12:48   ` Kishon Vijay Abraham I
2021-02-12 17:45 ` Lorenzo Pieralisi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.