diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-03-23 05:07:49 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-23 05:07:49 -0400 |
commit | b3e3b302cf6dc8d60b67f0e84d1fa5648889c038 (patch) | |
tree | 3f6150291664b4c62e328f6b1dcff79b54db612a /kernel/module.c | |
parent | a6bc3262c561780d2a6587aa3d5715b1e7d8fa13 (diff) | |
parent | 59fcbddaff6f862cc1584b488866d9c4a5579085 (diff) |
Merge branches 'irq/sparseirq' and 'linus' into irq/core
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/kernel/module.c b/kernel/module.c index ba22484a987e..1196f5d11700 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -2015,14 +2015,6 @@ static noinline struct module *load_module(void __user *umod, | |||
2015 | if (err < 0) | 2015 | if (err < 0) |
2016 | goto free_mod; | 2016 | goto free_mod; |
2017 | 2017 | ||
2018 | #if defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP) | ||
2019 | mod->refptr = percpu_modalloc(sizeof(local_t), __alignof__(local_t), | ||
2020 | mod->name); | ||
2021 | if (!mod->refptr) { | ||
2022 | err = -ENOMEM; | ||
2023 | goto free_mod; | ||
2024 | } | ||
2025 | #endif | ||
2026 | if (pcpuindex) { | 2018 | if (pcpuindex) { |
2027 | /* We have a special allocation for this section. */ | 2019 | /* We have a special allocation for this section. */ |
2028 | percpu = percpu_modalloc(sechdrs[pcpuindex].sh_size, | 2020 | percpu = percpu_modalloc(sechdrs[pcpuindex].sh_size, |
@@ -2030,7 +2022,7 @@ static noinline struct module *load_module(void __user *umod, | |||
2030 | mod->name); | 2022 | mod->name); |
2031 | if (!percpu) { | 2023 | if (!percpu) { |
2032 | err = -ENOMEM; | 2024 | err = -ENOMEM; |
2033 | goto free_percpu; | 2025 | goto free_mod; |
2034 | } | 2026 | } |
2035 | sechdrs[pcpuindex].sh_flags &= ~(unsigned long)SHF_ALLOC; | 2027 | sechdrs[pcpuindex].sh_flags &= ~(unsigned long)SHF_ALLOC; |
2036 | mod->percpu = percpu; | 2028 | mod->percpu = percpu; |
@@ -2082,6 +2074,14 @@ static noinline struct module *load_module(void __user *umod, | |||
2082 | /* Module has been moved. */ | 2074 | /* Module has been moved. */ |
2083 | mod = (void *)sechdrs[modindex].sh_addr; | 2075 | mod = (void *)sechdrs[modindex].sh_addr; |
2084 | 2076 | ||
2077 | #if defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP) | ||
2078 | mod->refptr = percpu_modalloc(sizeof(local_t), __alignof__(local_t), | ||
2079 | mod->name); | ||
2080 | if (!mod->refptr) { | ||
2081 | err = -ENOMEM; | ||
2082 | goto free_init; | ||
2083 | } | ||
2084 | #endif | ||
2085 | /* Now we've moved module, initialize linked lists, etc. */ | 2085 | /* Now we've moved module, initialize linked lists, etc. */ |
2086 | module_unload_init(mod); | 2086 | module_unload_init(mod); |
2087 | 2087 | ||
@@ -2288,15 +2288,17 @@ static noinline struct module *load_module(void __user *umod, | |||
2288 | ftrace_release(mod->module_core, mod->core_size); | 2288 | ftrace_release(mod->module_core, mod->core_size); |
2289 | free_unload: | 2289 | free_unload: |
2290 | module_unload_free(mod); | 2290 | module_unload_free(mod); |
2291 | free_init: | ||
2292 | #if defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP) | ||
2293 | percpu_modfree(mod->refptr); | ||
2294 | #endif | ||
2291 | module_free(mod, mod->module_init); | 2295 | module_free(mod, mod->module_init); |
2292 | free_core: | 2296 | free_core: |
2293 | module_free(mod, mod->module_core); | 2297 | module_free(mod, mod->module_core); |
2298 | /* mod will be freed with core. Don't access it beyond this line! */ | ||
2294 | free_percpu: | 2299 | free_percpu: |
2295 | if (percpu) | 2300 | if (percpu) |
2296 | percpu_modfree(percpu); | 2301 | percpu_modfree(percpu); |
2297 | #if defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP) | ||
2298 | percpu_modfree(mod->refptr); | ||
2299 | #endif | ||
2300 | free_mod: | 2302 | free_mod: |
2301 | kfree(args); | 2303 | kfree(args); |
2302 | free_hdr: | 2304 | free_hdr: |