summaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2015-01-20 09:07:04 +1030
committerRusty Russell <rusty@rustcorp.com.au>2015-01-20 11:38:32 +1030
commitd453cded05ee219b77815ea194dc36efa5398bca (patch)
tree9f38c5ed55b653803eabecce959320d734606029 /kernel/module.c
parentc772be52319de9756fd82f36d37a6d3e003441e3 (diff)
downloadop-kernel-dev-d453cded05ee219b77815ea194dc36efa5398bca.zip
op-kernel-dev-d453cded05ee219b77815ea194dc36efa5398bca.tar.gz
module_arch_freeing_init(): new hook for archs before module->module_init freed.
Archs have been abusing module_free() to clean up their arch-specific allocations. Since module_free() is also (ab)used by BPF and trace code, let's keep it to simple allocations, and provide a hook called before that. This means that avr32, ia64, parisc and s390 no longer need to implement their own module_free() at all. avr32 doesn't need module_finalize() either. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Cc: Chris Metcalf <cmetcalf@ezchip.com> Cc: Haavard Skinnemoen <hskinnemoen@gmail.com> Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no> Cc: Tony Luck <tony.luck@intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: "James E.J. Bottomley" <jejb@parisc-linux.org> Cc: Helge Deller <deller@gmx.de> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: linux-kernel@vger.kernel.org Cc: linux-ia64@vger.kernel.org Cc: linux-parisc@vger.kernel.org Cc: linux-s390@vger.kernel.org
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 3965511..68be0b1f 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1804,6 +1804,10 @@ void __weak module_arch_cleanup(struct module *mod)
{
}
+void __weak module_arch_freeing_init(struct module *mod)
+{
+}
+
/* Free a module, remove from lists, etc. */
static void free_module(struct module *mod)
{
@@ -1841,6 +1845,7 @@ static void free_module(struct module *mod)
/* This may be NULL, but that's OK */
unset_module_init_ro_nx(mod);
+ module_arch_freeing_init(mod);
module_free(mod, mod->module_init);
kfree(mod->args);
percpu_modfree(mod);
@@ -2930,6 +2935,7 @@ static struct module *layout_and_allocate(struct load_info *info, int flags)
static void module_deallocate(struct module *mod, struct load_info *info)
{
percpu_modfree(mod);
+ module_arch_freeing_init(mod);
module_free(mod, mod->module_init);
module_free(mod, mod->module_core);
}
@@ -3055,6 +3061,7 @@ static int do_init_module(struct module *mod)
mod->strtab = mod->core_strtab;
#endif
unset_module_init_ro_nx(mod);
+ module_arch_freeing_init(mod);
module_free(mod, mod->module_init);
mod->module_init = NULL;
mod->init_size = 0;
OpenPOWER on IntegriCloud