Re: [patch 03/25] debugobjects: Dont destroy kmem cache in init()

From: Thomas Gleixner
Date: Thu Oct 10 2024 - 07:46:38 EST


On Thu, Oct 10 2024 at 10:14, Leizhen wrote:
> On 2024/10/8 0:49, Thomas Gleixner wrote:
>> - if (!obj_cache || debug_objects_replace_static_objects()) {
>> + if (!cache || !debug_objects_replace_static_objects(cache)) {
>> debug_objects_enabled = 0;
>> - kmem_cache_destroy(obj_cache);
>
> kmem_cache_destroy(cache) should be kept, or move it into debug_objects_replace_static_objects()
> and place it above 'return false'.

At that point it can't be destroyed. See the backtrace.

So we just give the objects back and leak the kmem_cache.

Thanks,

tglx