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

From: Luis Chamberlain
Date: Fri Sep 06 2024 - 19:25:10 EST


On Thu, Sep 05, 2024 at 11:44:00AM +0200, Thomas Gleixner wrote:
> Now you at least provided the information that the missing cleanup in
> the init() function is not the problem. So the obvious place to look is
> in the module core code whether there is a failure path _after_
> module->init() returned success.
>
> do_init_module()
> ret = do_one_initcall(mod->init);
> ...
> ret = module_enable_rodata_ro(mod, true);
> if (ret)
> goto fail_mutex_unlock;
>
> and that error path does _not_ invoke module->exit(), which is obviously
> not correct. Luis?

You're spot on this needs fixing.

Luis