11/*
22 Copyright (C) 2002 Richard Henderson
3- Copyright (C) 2001 Rusty Russell, 2002 Rusty Russell IBM.
3+ Copyright (C) 2001 Rusty Russell, 2002, 2010 Rusty Russell IBM.
44
55 This program is free software; you can redistribute it and/or modify
66 it under the terms of the GNU General Public License as published by
@@ -2523,12 +2523,14 @@ static void module_deallocate(struct module *mod, struct load_info *info)
25232523
25242524static int post_relocation (struct module * mod , const struct load_info * info )
25252525{
2526+ /* Sort exception table now relocations are done. */
25262527 sort_extable (mod -> extable , mod -> extable + mod -> num_exentries );
25272528
25282529 /* Copy relocated percpu area over. */
25292530 percpu_modcopy (mod , (void * )info -> sechdrs [info -> index .pcpu ].sh_addr ,
25302531 info -> sechdrs [info -> index .pcpu ].sh_size );
25312532
2533+ /* Setup kallsyms-specific fields. */
25322534 add_kallsyms (mod , info );
25332535
25342536 /* Arch-specific module finalizing. */
@@ -2537,7 +2539,7 @@ static int post_relocation(struct module *mod, const struct load_info *info)
25372539
25382540/* Allocate and load the module: note that size of section 0 is always
25392541 zero, and we rely on this for optional sections. */
2540- static noinline struct module * load_module (void __user * umod ,
2542+ static struct module * load_module (void __user * umod ,
25412543 unsigned long len ,
25422544 const char __user * uargs )
25432545{
@@ -2598,6 +2600,7 @@ static noinline struct module *load_module(void __user *umod,
25982600 goto free_arch_cleanup ;
25992601 }
26002602
2603+ /* Mark state as coming so strong_try_module_get() ignores us. */
26012604 mod -> state = MODULE_STATE_COMING ;
26022605
26032606 /* Now sew it into the lists so we can get lockdep and oops
@@ -2625,10 +2628,12 @@ static noinline struct module *load_module(void __user *umod,
26252628 list_add_rcu (& mod -> list , & modules );
26262629 mutex_unlock (& module_mutex );
26272630
2631+ /* Module is ready to execute: parsing args may do that. */
26282632 err = parse_args (mod -> name , mod -> args , mod -> kp , mod -> num_kp , NULL );
26292633 if (err < 0 )
26302634 goto unlink ;
26312635
2636+ /* Link in to syfs. */
26322637 err = mod_sysfs_setup (mod , & info , mod -> kp , mod -> num_kp );
26332638 if (err < 0 )
26342639 goto unlink ;
@@ -2637,9 +2642,8 @@ static noinline struct module *load_module(void __user *umod,
26372642 kfree (info .strmap );
26382643 free_copy (& info );
26392644
2640- trace_module_load (mod );
2641-
26422645 /* Done! */
2646+ trace_module_load (mod );
26432647 return mod ;
26442648
26452649 unlink :
0 commit comments