Bug 115331

Summary: uncertain outcome about loading module
Product: Other Reporter: jackyzhao (zhaogongyi.jxjian)
Component: ModulesAssignee: other_modules
Status: NEW ---    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.10.97 Subsystem:
Regression: No Bisected commit-id:

Description jackyzhao 2016-03-27 15:00:20 UTC
Hi,I have a problem about loading module.The funciont do_init_module in 3.10.97 kernel is:
--------------------------------------------------------------------------------
/* This is where the real work happens */
static int do_init_module(struct module *mod)
{
	int ret = 0;

	/*
	 * We want to find out whether @mod uses async during init.  Clear
	 * PF_USED_ASYNC.  async_schedule*() will set it.
	 */
	current->flags &= ~PF_USED_ASYNC;

	blocking_notifier_call_chain(&module_notify_list,
			MODULE_STATE_COMING, mod);

	/* Set RO and NX regions for core */
	set_section_ro_nx(mod->module_core,
				mod->core_text_size,
				mod->core_ro_size,
				mod->core_size);

	/* Set RO and NX regions for init */
	set_section_ro_nx(mod->module_init,
				mod->init_text_size,
				mod->init_ro_size,
				mod->init_size);

	do_mod_ctors(mod);
	/* Start the module */
	if (mod->init != NULL)
		ret = do_one_initcall(mod->init);
	if (ret < 0) {
		/* Init routine failed: abort.  Try to protect us from
                   buggy refcounters. */
		mod->state = MODULE_STATE_GOING;
		synchronize_sched();
		module_put(mod);
		blocking_notifier_call_chain(&module_notify_list,
					     MODULE_STATE_GOING, mod);
		free_module(mod);
		wake_up_all(&module_wq);
		return ret;
	}
	if (ret > 0) {
		printk(KERN_WARNING
"%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();
	}
      ...
--------------------------------------------------------------------------------
My question is when my module_init defined as:
    void __init__ func_init(*)
then the ret of func_init(*) will be alterable,it depends on specifically running enviroment,that's what we want?