Re: [PATCH RFC v3 4/4] module: refactor ro_after_init failure path

From: Christophe Leroy
Date: Sat Nov 09 2024 - 04:49:49 EST




Le 08/11/2024 à 17:12, Daniel Gomez via B4 Relay a écrit :
[Vous ne recevez pas souvent de courriers de devnull+da.gomez.samsung.com@xxxxxxxxxx. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]

From: Daniel Gomez <da.gomez@xxxxxxxxxxx>

When ro_after_init fails, we need to unload the module.

Rename the goto tag to fail_ro_after_init to make it more clear and try
to check for dependencies, stop the module and call the exit function.
This allows to unload the module if ro_after_init fails.

Doesn't build:

CC kernel/module/main.o
kernel/module/main.c: In function 'do_init_module':
kernel/module/main.c:2626:19: error: 'struct module' has no member named 'source_list'; did you mean 'bug_list'?
list_empty(&mod->source_list);
^~~~~~~~~~~
bug_list
kernel/module/main.c:2627:2: error: implicit declaration of function 'try_stop_module'; did you mean 'do_init_module'? [-Werror=implicit-function-declaration]
try_stop_module(mod, 0, &forced);
^~~~~~~~~~~~~~~
do_init_module
kernel/module/main.c:2629:11: error: 'struct module' has no member named 'exit'; did you mean 'init'?
if (mod->exit != NULL)
^~~~
init
kernel/module/main.c:2630:8: error: 'struct module' has no member named 'exit'; did you mean 'init'?
mod->exit();
^~~~
init



Christophe