|
@@ -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. */
|
|
/* Free a module, remove from lists, etc. */
|
|
static void free_module(struct module *mod)
|
|
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 */
|
|
/* This may be NULL, but that's OK */
|
|
unset_module_init_ro_nx(mod);
|
|
unset_module_init_ro_nx(mod);
|
|
|
|
+ module_arch_freeing_init(mod);
|
|
module_free(mod, mod->module_init);
|
|
module_free(mod, mod->module_init);
|
|
kfree(mod->args);
|
|
kfree(mod->args);
|
|
percpu_modfree(mod);
|
|
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)
|
|
static void module_deallocate(struct module *mod, struct load_info *info)
|
|
{
|
|
{
|
|
percpu_modfree(mod);
|
|
percpu_modfree(mod);
|
|
|
|
+ module_arch_freeing_init(mod);
|
|
module_free(mod, mod->module_init);
|
|
module_free(mod, mod->module_init);
|
|
module_free(mod, mod->module_core);
|
|
module_free(mod, mod->module_core);
|
|
}
|
|
}
|
|
@@ -3055,6 +3061,7 @@ static int do_init_module(struct module *mod)
|
|
mod->strtab = mod->core_strtab;
|
|
mod->strtab = mod->core_strtab;
|
|
#endif
|
|
#endif
|
|
unset_module_init_ro_nx(mod);
|
|
unset_module_init_ro_nx(mod);
|
|
|
|
+ module_arch_freeing_init(mod);
|
|
module_free(mod, mod->module_init);
|
|
module_free(mod, mod->module_init);
|
|
mod->module_init = NULL;
|
|
mod->module_init = NULL;
|
|
mod->init_size = 0;
|
|
mod->init_size = 0;
|