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] [day] [month] [year] [list]
Message-ID: <1d186b5a-c201-20ae-b513-7152e09f8f43@huawei.com>
Date:   Tue, 25 Oct 2022 20:50:54 +0800
From:   Yang Yingliang <yangyingliang@...wei.com>
To:     Paolo Abeni <pabeni@...hat.com>, <netdev@...r.kernel.org>
CC:     <dougmill@...ux.ibm.com>, <davem@...emloft.net>, <kuba@...nel.org>
Subject: Re: [PATCH net] net: ehea: fix possible memory leak in
 ehea_register_port()


On 2022/10/25 20:16, Yang Yingliang wrote:
> Hi,
>
> On 2022/10/25 19:55, Paolo Abeni wrote:
>> Hello,
>>
>> On Sat, 2022-10-22 at 19:37 +0800, Yang Yingliang wrote:
>>> dev_set_name() in ehea_register_port() allocates memory for name,
>>> it need be freed when of_device_register() fails, call put_device()
>>> to give up the reference that hold in device_initialize(), so that
>>> it can be freed in kobject_cleanup() when the refcount hit to 0.
>>>
>>> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
>>> ---
>>>   drivers/net/ethernet/ibm/ehea/ehea_main.c | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c 
>>> b/drivers/net/ethernet/ibm/ehea/ehea_main.c
>>> index 294bdbbeacc3..b4aff59b3eb4 100644
>>> --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
>>> +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
>>> @@ -2900,6 +2900,7 @@ static struct device 
>>> *ehea_register_port(struct ehea_port *port,
>>>       ret = of_device_register(&port->ofdev);
>>>       if (ret) {
>>>           pr_err("failed to register device. ret=%d\n", ret);
>>> +        put_device(&port->ofdev.dev);
>>>           goto out;
>>>       }
>> You need to include a suitable Fixes tag into the commit message.
>> Additionally, if you have a kmemleak splat handy, please include even
>> that in the commit message.
> Fixes: 1fa5ae857bb1 ("driver core: get rid of struct device's bus_id 
> string array")
>
> Afer commit 1fa5ae857bb1 ("driver core: get rid of struct device's
> bus_id string array"), the name of device is allocated dynamically.
It should be 1acf2318dd13 ("ehea: dynamic add / remove port"). I will
add it in v2.

Thanks,
Yang
>
>>
>> Thanks!
>>
>> Paolo
>>
>>
>> .
>
> .

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ