Re: [PATCH] static_call: Handle module init failure correctly in static_call_del_module()

From: Jinjie Ruan
Date: Wed Sep 04 2024 - 05:51:00 EST




On 2024/9/4 16:51, Thomas Gleixner wrote:
> On Wed, Sep 04 2024 at 16:03, Jinjie Ruan wrote:
>> On 2024/9/4 15:08, Thomas Gleixner wrote:
>>> So the check must be:
>>>
>>> if (!static_call_key_has_mods(key))
>>> break;
>>
>> Hi, Thomas,
>>
>> with this patch, the issue not occurs again,
>>
>> but there are some memory leak here same to the following problem:
>
> That has absolutely nothing to do with static calls and the memory
> allocation failure case there.
>
> The module passed all preparatory steps, otherwise it would not be able
> to create a kmem_cache from the module init() function:
>
> kmem_cache_create+0x11/0x20
> do_one_initcall+0xdc/0x550
> do_init_module+0x241/0x630
>
> amdgpu_init()
>
> r = amdgpu_sync_init();
> if (r)
> goto error_sync;
>
> r = amdgpu_fence_slab_init();
> if (r)
> goto error_fence;
>
> <SNIP>
>
> return pci_register_driver(&amdgpu_kms_pci_driver);
>
> error_fence:
> amdgpu_sync_fini();
> error_sync:
> return r;
>
> Can you spot the problem?

I see, let me test it.

>
> Thanks,
>
> tglx