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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <297b3e63-efa5-fc14-35d7-2f6e7e334122@huawei.com>
Date:   Fri, 21 Oct 2022 17:13:10 +0800
From:   shaozhengchao <shaozhengchao@...wei.com>
To:     Jakub Kicinski <kuba@...nel.org>
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 2022/10/21 16:28, shaozhengchao wrote:
> 
> 
> On 2022/10/21 8:26, Jakub Kicinski wrote:
>> 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.
>>
> OK, I will check it.
Sorry, I check this commit introduce the bug. What do I have missed?

>>> 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.
>>
> Hi Jakub:
>      Thank you for your review. I will change it in v2.
> 
> Zhengchao Shao
>>>       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

Powered by Openwall GNU/*/Linux Powered by OpenVZ