aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/module.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/kernel/module.c b/kernel/module.c
index f3cba93ea1e3..d0b5f8db11b4 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1,6 +1,6 @@
1/* 1/*
2 Copyright (C) 2002 Richard Henderson 2 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.
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 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)
2523 2523
2524static int post_relocation(struct module *mod, const struct load_info *info) 2524static int post_relocation(struct module *mod, const struct load_info *info)
2525{ 2525{
2526 /* Sort exception table now relocations are done. */
2526 sort_extable(mod->extable, mod->extable + mod->num_exentries); 2527 sort_extable(mod->extable, mod->extable + mod->num_exentries);
2527 2528
2528 /* Copy relocated percpu area over. */ 2529 /* Copy relocated percpu area over. */
2529 percpu_modcopy(mod, (void *)info->sechdrs[info->index.pcpu].sh_addr, 2530 percpu_modcopy(mod, (void *)info->sechdrs[info->index.pcpu].sh_addr,
2530 info->sechdrs[info->index.pcpu].sh_size); 2531 info->sechdrs[info->index.pcpu].sh_size);
2531 2532
2533 /* Setup kallsyms-specific fields. */
2532 add_kallsyms(mod, info); 2534 add_kallsyms(mod, info);
2533 2535
2534 /* Arch-specific module finalizing. */ 2536 /* Arch-specific module finalizing. */
@@ -2537,7 +2539,7 @@ static int post_relocation(struct module *mod, const struct load_info *info)
2537 2539
2538/* Allocate and load the module: note that size of section 0 is always 2540/* Allocate and load the module: note that size of section 0 is always
2539 zero, and we rely on this for optional sections. */ 2541 zero, and we rely on this for optional sections. */
2540static noinline struct module *load_module(void __user *umod, 2542static struct module *load_module(void __user *umod,
2541 unsigned long len, 2543 unsigned long len,
2542 const char __user *uargs) 2544 const char __user *uargs)
2543{ 2545{
@@ -2598,6 +2600,7 @@ static noinline struct module *load_module(void __user *umod,
2598 goto free_arch_cleanup; 2600 goto free_arch_cleanup;
2599 } 2601 }
2600 2602
2603 /* Mark state as coming so strong_try_module_get() ignores us. */
2601 mod->state = MODULE_STATE_COMING; 2604 mod->state = MODULE_STATE_COMING;
2602 2605
2603 /* Now sew it into the lists so we can get lockdep and oops 2606 /* 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,
2625 list_add_rcu(&mod->list, &modules); 2628 list_add_rcu(&mod->list, &modules);
2626 mutex_unlock(&module_mutex); 2629 mutex_unlock(&module_mutex);
2627 2630
2631 /* Module is ready to execute: parsing args may do that. */
2628 err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, NULL); 2632 err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, NULL);
2629 if (err < 0) 2633 if (err < 0)
2630 goto unlink; 2634 goto unlink;
2631 2635
2636 /* Link in to syfs. */
2632 err = mod_sysfs_setup(mod, &info, mod->kp, mod->num_kp); 2637 err = mod_sysfs_setup(mod, &info, mod->kp, mod->num_kp);
2633 if (err < 0) 2638 if (err < 0)
2634 goto unlink; 2639 goto unlink;
@@ -2637,9 +2642,8 @@ static noinline struct module *load_module(void __user *umod,
2637 kfree(info.strmap); 2642 kfree(info.strmap);
2638 free_copy(&info); 2643 free_copy(&info);
2639 2644
2640 trace_module_load(mod);
2641
2642 /* Done! */ 2645 /* Done! */
2646 trace_module_load(mod);
2643 return mod; 2647 return mod;
2644 2648
2645 unlink: 2649 unlink: