On 7/27/23 10:29, Jason Gunthorpe wrote:
On Thu, Jul 27, 2023 at 05:17:40PM +0000, Bernard Metzler wrote:
very good catch, thank you. I was under the wrong assumption a
module is not loaded if the init_module() returns a value.
I think that is actually true, isn't it? I'm confused?
My understanding is also that module loading should fail if
init_module() returns an error code. From kernel/module/main.c:
/* Start the module */
if (mod->init != NULL)
ret = do_one_initcall(mod->init);
if (ret < 0) {
goto fail_free_freeinit;
}
if (ret > 0) {
pr_warn("%s: '%s'->init suspiciously returned %d, it "
"should follow 0/-E convention\n"
"%s: loading module anyway...\n",
__func__, mod->name, ret, __func__);
dump_stack();
}
Bart.