• A
    modules: warn about suspicious return values from module's ->init() hook · e24e2e64
    Alexey Dobriyan 提交于
    Return value convention of module's init functions is 0/-E.  Sometimes,
    e.g.  during forward-porting mistakes happen and buggy module created,
    where result of comparison "workqueue != NULL" is propagated all the way up
    to sys_init_module.  What happens is that some other module created
    workqueue in question, our module created it again and module was
    successfully loaded.
    
    Or it could be some other bug.
    
    Let's make such mistakes much more visible.  In retrospective, such
    messages would noticeably shorten some of my head-scratching sessions.
    
    Note, that dump_stack() is just a way to get attention from user.  Sample
    message:
    
    sys_init_module: 'foo'->init suspiciously returned 1, it should follow 0/-E convention
    sys_init_module: loading module anyway...
    Pid: 4223, comm: modprobe Not tainted 2.6.24-25f66630 #5
    
    Call Trace:
     [<ffffffff80254b05>] sys_init_module+0xe5/0x1d0
     [<ffffffff8020b39b>] system_call_after_swapgs+0x7b/0x80
    Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
    Cc: Rusty Russell <rusty@rustcorp.com.au>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    e24e2e64
module.c 66.8 KB