lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 20 Oct 2022 17:26:12 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Zhengchao Shao <shaozhengchao@...wei.com>
Cc:     <netdev@...r.kernel.org>, <davem@...emloft.net>,
        <edumazet@...gle.com>, <pabeni@...hat.com>, <jiri@...lanox.com>,
        <weiyongjun1@...wei.com>, <yuehaibing@...wei.com>
Subject: Re: [PATCH net 1/2] netdevsim: fix memory leak in nsim_drv_probe()
 when nsim_dev_resources_register() failed

On Thu, 20 Oct 2022 10:33:57 +0800 Zhengchao Shao wrote:
> Fixes: 8fb4bc6fd5bd ("netdevsim: rename devlink.c to dev.c to contain per-dev(asic) items")

Looks like a rename patch.

The Fixes tag must point to the commit which introduced the bug.

> diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c
> index 794fc0cc73b8..39231c5319de 100644
> --- a/drivers/net/netdevsim/dev.c
> +++ b/drivers/net/netdevsim/dev.c
> @@ -1554,7 +1554,7 @@ int nsim_drv_probe(struct nsim_bus_dev *nsim_bus_dev)
>  
>  	err = nsim_dev_resources_register(devlink);
>  	if (err)
> -		goto err_vfc_free;
> +		goto err_dl_unregister;

It's better to add the devl_resources_unregister() call to the error
path of nsim_dev_resources_register(). There should be no need to clean
up after functions when they fail.

>  	err = devlink_params_register(devlink, nsim_devlink_params,
>  				      ARRAY_SIZE(nsim_devlink_params));
> @@ -1627,7 +1627,6 @@ int nsim_drv_probe(struct nsim_bus_dev *nsim_bus_dev)
>  				  ARRAY_SIZE(nsim_devlink_params));
>  err_dl_unregister:
>  	devl_resources_unregister(devlink);
> -err_vfc_free:
>  	kfree(nsim_dev->vfconfigs);

Powered by blists - more mailing lists