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]
Date:   Tue, 15 Nov 2022 11:38:26 +0800
From:   wangyufen <wangyufen@...wei.com>
To:     Jakub Kicinski <kuba@...nel.org>
CC:     <netdev@...r.kernel.org>, <davem@...emloft.net>,
        <edumazet@...gle.com>, <pabeni@...hat.com>,
        Jiri Pirko <jiri@...lanox.com>
Subject: Re: [PATCH] netdevsim: Fix memory leak of nsim_dev->fa_cookie


在 2022/11/15 10:50, Jakub Kicinski 写道:
> On Sat, 12 Nov 2022 14:28:05 +0800 Wang Yufen wrote:
>> nsim_dev_trap_fa_cookie_write()
>>    kmalloc() fa_cookie
>>    nsim_dev->fa_cookie = fa_cookie
>> ..
>> nsim_drv_remove()
>>
>> nsim_dev->fa_cookie alloced, but the nsim_dev_trap_report_work()
>> job has not been done, the flow action cookie has not been assigned
>> to the metadata. To fix, add kfree(nsim_dev->fa_cookie) to
>> nsim_drv_remove().
> I don't see the path thru nsim_dev_trap_report_work() which would free
> the fa_cookie.
>
> The fix looks right, but the commit message seems incorrect. Isn't the
> leak always there, without any race?

Sorry, I didn't make it clear.

The detailed process of nsim_dev_trap_report_work() is as follows:

nsim_dev_trap_report_work()
   nsim_dev_trap_report_work()
     ...
     devlink_trap_report()
       devlink_trap_report_metadata_set()
       <-- fa_cookie is assigned to metadata->fa_cookie here, and will be freed in net_dm_hw_metadata_free()

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ