aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/kernel/module.c b/kernel/module.c
index d753fd9d83ec..7576c2d9462f 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1431,6 +1431,9 @@ static void free_module(struct module *mod)
1431 /* Module unload stuff */ 1431 /* Module unload stuff */
1432 module_unload_free(mod); 1432 module_unload_free(mod);
1433 1433
1434 /* release any pointers to mcount in this module */
1435 ftrace_release(mod->module_core, mod->core_size);
1436
1434 /* This may be NULL, but that's OK */ 1437 /* This may be NULL, but that's OK */
1435 module_free(mod, mod->module_init); 1438 module_free(mod, mod->module_init);
1436 kfree(mod->args); 1439 kfree(mod->args);
@@ -1839,6 +1842,7 @@ static noinline struct module *load_module(void __user *umod,
1839 struct module *mod; 1842 struct module *mod;
1840 long err = 0; 1843 long err = 0;
1841 void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */ 1844 void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */
1845 void *mseg;
1842 struct exception_table_entry *extable; 1846 struct exception_table_entry *extable;
1843 mm_segment_t old_fs; 1847 mm_segment_t old_fs;
1844 1848
@@ -2190,10 +2194,9 @@ static noinline struct module *load_module(void __user *umod,
2190#endif 2194#endif
2191 } 2195 }
2192 2196
2193 if (mcountindex) { 2197 /* sechdrs[0].sh_size is always zero */
2194 void *mseg = (void *)sechdrs[mcountindex].sh_addr; 2198 mseg = (void *)sechdrs[mcountindex].sh_addr;
2195 ftrace_init_module(mseg, mseg + sechdrs[mcountindex].sh_size); 2199 ftrace_init_module(mseg, mseg + sechdrs[mcountindex].sh_size);
2196 }
2197 2200
2198 err = module_finalize(hdr, sechdrs, mod); 2201 err = module_finalize(hdr, sechdrs, mod);
2199 if (err < 0) 2202 if (err < 0)
@@ -2264,6 +2267,7 @@ static noinline struct module *load_module(void __user *umod,
2264 cleanup: 2267 cleanup:
2265 kobject_del(&mod->mkobj.kobj); 2268 kobject_del(&mod->mkobj.kobj);
2266 kobject_put(&mod->mkobj.kobj); 2269 kobject_put(&mod->mkobj.kobj);
2270 ftrace_release(mod->module_core, mod->core_size);
2267 free_unload: 2271 free_unload:
2268 module_unload_free(mod); 2272 module_unload_free(mod);
2269 module_free(mod, mod->module_init); 2273 module_free(mod, mod->module_init);