Re: [PATCH net v3] drivers: net: ionic: add missed debugfs cleanup to ionic_probe() error path

From: Nelson, Shannon
Date: Thu Nov 07 2024 - 14:48:01 EST


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@xxxxxxx>

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@xxxxxxx>

Thanks! -sln

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

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