netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v3] drivers: net: ionic: add missed debugfs cleanup to ionic_probe() error path
@ 2024-11-07  2:17 Wentao Liang
  2024-11-07 19:31 ` Nelson, Shannon
  2024-11-07 19:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Wentao Liang @ 2024-11-07  2:17 UTC (permalink / raw)
  To: shannon.nelson, brett.creeley, davem, kuba
  Cc: linux-kernel, netdev, Wentao Liang

From: Wentao Liang <Wentao_liang_g@163.com>

The ionic_setup_one() creates a debugfs entry for ionic upon
successful execution. However, the ionic_probe() does not
release the dentry before returning, resulting in a memory
leak.

To fix this bug, we add the ionic_debugfs_del_dev() to release
the resources in a timely manner before returning.

Fixes: 0de38d9f1dba ("ionic: extract common bits from ionic_probe")
Signed-off-by: Wentao Liang <Wentao_liang_g@163.com>
---
 drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
index b93791d6b593..f5dc876eb500 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
@@ -394,6 +394,7 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 err_out_pci:
 	ionic_dev_teardown(ionic);
 	ionic_clear_pci(ionic);
+	ionic_debugfs_del_dev(ionic);
 err_out:
 	mutex_destroy(&ionic->dev_cmd_lock);
 	ionic_devlink_free(ionic);
-- 
2.42.0.windows.2


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

* Re: [PATCH net v3] drivers: net: ionic: add missed debugfs cleanup to ionic_probe() error path
  2024-11-07  2:17 [PATCH net v3] drivers: net: ionic: add missed debugfs cleanup to ionic_probe() error path Wentao Liang
@ 2024-11-07 19:31 ` Nelson, Shannon
  2024-11-07 19:44   ` Jakub Kicinski
  2024-11-07 19:50 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 5+ messages in thread
From: Nelson, Shannon @ 2024-11-07 19:31 UTC (permalink / raw)
  To: Wentao Liang, brett.creeley, davem, kuba
  Cc: linux-kernel, netdev, Wentao Liang

On 11/6/2024 6:17 PM, Wentao Liang wrote:
> 
> From: Wentao Liang <Wentao_liang_g@163.com>
> 
> The ionic_setup_one() creates a debugfs entry for ionic upon
> successful execution. However, the ionic_probe() does not
> release the dentry before returning, resulting in a memory
> leak.
> 
> To fix this bug, we add the ionic_debugfs_del_dev() to release
> the resources in a timely manner before returning.
> 
> Fixes: 0de38d9f1dba ("ionic: extract common bits from ionic_probe")
> Signed-off-by: Wentao Liang <Wentao_liang_g@163.com>

Thanks!  -sln

Acked-by: Shannon Nelson <shannon.nelson@amd.com>



> ---
>   drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
> index b93791d6b593..f5dc876eb500 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
> @@ -394,6 +394,7 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>   err_out_pci:
>          ionic_dev_teardown(ionic);
>          ionic_clear_pci(ionic);
> +       ionic_debugfs_del_dev(ionic);
>   err_out:
>          mutex_destroy(&ionic->dev_cmd_lock);
>          ionic_devlink_free(ionic);
> --
> 2.42.0.windows.2
> 

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

* Re: [PATCH net v3] drivers: net: ionic: add missed debugfs cleanup to ionic_probe() error path
  2024-11-07 19:31 ` Nelson, Shannon
@ 2024-11-07 19:44   ` Jakub Kicinski
  2024-11-07 19:47     ` Nelson, Shannon
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2024-11-07 19:44 UTC (permalink / raw)
  To: Nelson, Shannon
  Cc: Wentao Liang, brett.creeley, davem, linux-kernel, netdev,
	Wentao Liang

On Thu, 7 Nov 2024 11:31:50 -0800 Nelson, Shannon wrote:
> On 11/6/2024 6:17 PM, Wentao Liang wrote:
> > 
> > From: Wentao Liang <Wentao_liang_g@163.com>
> > 
> > The ionic_setup_one() creates a debugfs entry for ionic upon
> > successful execution. However, the ionic_probe() does not
> > release the dentry before returning, resulting in a memory
> > leak.
> > 
> > To fix this bug, we add the ionic_debugfs_del_dev() to release
> > the resources in a timely manner before returning.
> > 
> > Fixes: 0de38d9f1dba ("ionic: extract common bits from ionic_probe")
> > Signed-off-by: Wentao Liang <Wentao_liang_g@163.com>  
> 
> Thanks!  -sln
> 
> Acked-by: Shannon Nelson <shannon.nelson@amd.com>

Just in time to still make today's PR ;)

This change looks fine but as a future refactoring perhaps there should
be a wrapper for:

        ionic_dev_teardown(ionic);                                              
        ionic_clear_pci(ionic);                                                 
        ionic_debugfs_del_dev(ionic);

which pairs with ionic_setup() ?

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

* Re: [PATCH net v3] drivers: net: ionic: add missed debugfs cleanup to ionic_probe() error path
  2024-11-07 19:44   ` Jakub Kicinski
@ 2024-11-07 19:47     ` Nelson, Shannon
  0 siblings, 0 replies; 5+ messages in thread
From: Nelson, Shannon @ 2024-11-07 19:47 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Wentao Liang, brett.creeley, davem, linux-kernel, netdev,
	Wentao Liang

On 11/7/2024 11:44 AM, Jakub Kicinski wrote:
> 
> On Thu, 7 Nov 2024 11:31:50 -0800 Nelson, Shannon wrote:
>> On 11/6/2024 6:17 PM, Wentao Liang wrote:
>>>
>>> From: Wentao Liang <Wentao_liang_g@163.com>
>>>
>>> The ionic_setup_one() creates a debugfs entry for ionic upon
>>> successful execution. However, the ionic_probe() does not
>>> release the dentry before returning, resulting in a memory
>>> leak.
>>>
>>> To fix this bug, we add the ionic_debugfs_del_dev() to release
>>> the resources in a timely manner before returning.
>>>
>>> Fixes: 0de38d9f1dba ("ionic: extract common bits from ionic_probe")
>>> Signed-off-by: Wentao Liang <Wentao_liang_g@163.com>
>>
>> Thanks!  -sln
>>
>> Acked-by: Shannon Nelson <shannon.nelson@amd.com>
> 
> Just in time to still make today's PR ;)
> 
> This change looks fine but as a future refactoring perhaps there should
> be a wrapper for:
> 
>          ionic_dev_teardown(ionic);
>          ionic_clear_pci(ionic);
>          ionic_debugfs_del_dev(ionic);
> 
> which pairs with ionic_setup() ?

Thanks, we'll keep that in mind.
sln

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

* Re: [PATCH net v3] drivers: net: ionic: add missed debugfs cleanup to ionic_probe() error path
  2024-11-07  2:17 [PATCH net v3] drivers: net: ionic: add missed debugfs cleanup to ionic_probe() error path Wentao Liang
  2024-11-07 19:31 ` Nelson, Shannon
@ 2024-11-07 19:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-11-07 19:50 UTC (permalink / raw)
  To: Wentao Liang
  Cc: shannon.nelson, brett.creeley, davem, kuba, linux-kernel, netdev,
	Wentao_liang_g

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu,  7 Nov 2024 10:17:56 +0800 you wrote:
> From: Wentao Liang <Wentao_liang_g@163.com>
> 
> The ionic_setup_one() creates a debugfs entry for ionic upon
> successful execution. However, the ionic_probe() does not
> release the dentry before returning, resulting in a memory
> leak.
> 
> [...]

Here is the summary with links:
  - [net,v3] drivers: net: ionic: add missed debugfs cleanup to ionic_probe() error path
    https://git.kernel.org/netdev/net/c/71712cf519fa

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-11-07 19:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-07  2:17 [PATCH net v3] drivers: net: ionic: add missed debugfs cleanup to ionic_probe() error path Wentao Liang
2024-11-07 19:31 ` Nelson, Shannon
2024-11-07 19:44   ` Jakub Kicinski
2024-11-07 19:47     ` Nelson, Shannon
2024-11-07 19:50 ` patchwork-bot+netdevbpf

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).