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] [day] [month] [year] [list]
Message-ID: <154e624b-f0fa-4925-8ae5-4f176216e724@kylinos.cn>
Date: Wed, 22 Nov 2023 14:57:06 +0800
From: Kunwu Chan <chentao@...inos.cn>
To: Alexander Lobakin <aleksander.lobakin@...el.com>
Cc: horms@...nel.org, anthony.l.nguyen@...el.com, davem@...emloft.net,
 edumazet@...gle.com, intel-wired-lan@...ts.osuosl.org,
 jeffrey.t.kirsher@...el.com, jesse.brandeburg@...el.com, kuba@...nel.org,
 kunwu.chan@...mail.com, linux-kernel@...r.kernel.org,
 netdev@...r.kernel.org, pabeni@...hat.com, shannon.nelson@....com
Subject: Re: [PATCH iwl-next] i40e: Use correct buffer size

Thanks you again for your reply.
I learned. I know how to use it, thanks, I'll look at the existing code 
and add logs to see how it works.

Thanks again.


On 2023/11/21 19:15, Alexander Lobakin wrote:
> From: Kunwu Chan <chentao@...inos.cn>
> Date: Tue, 21 Nov 2023 10:12:17 +0800
> 
>> Thanks for your reply. I understand what you mean, i.e. the caller of
>> 'kasprintf' is responsible for calling 'kfree' to free up memory.
>>
>> My concern is that in many scenarios, the requested memory will be
>> released after a period of use.
>>
>> Has anyone else forgotten to free up the requested memory when using
>> 'kasprintf'? e.g. 'dam_heap_init' calls 'dma_heap_devnode' to allocate
>> memory:
>> dam_heap_init
>>      -> dma_heap_devnode
>>            -> kasprintf
>>              ->kvasprintf
>>                   ->kmalloc_node_track_caller
>>                    -> __kmalloc_node_track_caller
>>                        -> __do_kmalloc_node
>>                            -> kasan_kmalloc
>>
>>
>> There is no function like 'dam_heap_exit' to free the memmory allocated
>> by dma_heap_devnode.
>>
>> Another case is 'cpuid_devnode'. Will this cause a memory leak, and is
>> there a better way to avoid the memory leak in this case?
>>
>> Or is there a uniform place in the memory management module to free up
>> this memory?
> 
> If the lifetime of the allocated buffer equals to the lifetime of the
> kernel, i.e. it's allocated once at kernel init and then used throughout
> the whole uptime, there's no need to free this piece.
> Temporary buffers or buffers allocated from a driver are a different
> story, their lifetime is shorter, which means you always need to
> manually free each of them on exit.
> 
>>
>> Thanks,
>> Kunwu
> Thanks,
> Olek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ