aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2015-01-19 17:37:05 -0500
committerRusty Russell <rusty@rustcorp.com.au>2015-01-19 20:08:33 -0500
commitbe1f221c0445a4157d177197c236f888d3581914 (patch)
treef823a0f9cab00723043d8c27f11d23f9e0c9a592 /kernel
parentd453cded05ee219b77815ea194dc36efa5398bca (diff)
module: remove mod arg from module_free, rename module_memfree().
Nothing needs the module pointer any more, and the next patch will call it from RCU, where the module itself might no longer exist. Removing the arg is the safest approach. This just codifies the use of the module_alloc/module_free pattern which ftrace and bpf use. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Acked-by: Alexei Starovoitov <ast@kernel.org> Cc: Mikael Starvik <starvik@axis.com> Cc: Jesper Nilsson <jesper.nilsson@axis.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Ley Foon Tan <lftan@altera.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Chris Metcalf <cmetcalf@ezchip.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: x86@kernel.org Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: linux-cris-kernel@axis.com Cc: linux-kernel@vger.kernel.org Cc: linux-mips@linux-mips.org Cc: nios2-dev@lists.rocketboards.org Cc: linuxppc-dev@lists.ozlabs.org Cc: sparclinux@vger.kernel.org Cc: netdev@vger.kernel.org
Diffstat (limited to 'kernel')
-rw-r--r--kernel/bpf/core.c2
-rw-r--r--kernel/kprobes.c2
-rw-r--r--kernel/module.c14
3 files changed, 9 insertions, 9 deletions
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index d6594e457a25..a64e7a207d2b 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -163,7 +163,7 @@ bpf_jit_binary_alloc(unsigned int proglen, u8 **image_ptr,
163 163
164void bpf_jit_binary_free(struct bpf_binary_header *hdr) 164void bpf_jit_binary_free(struct bpf_binary_header *hdr)
165{ 165{
166 module_free(NULL, hdr); 166 module_memfree(hdr);
167} 167}
168#endif /* CONFIG_BPF_JIT */ 168#endif /* CONFIG_BPF_JIT */
169 169
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 06f58309fed2..ee619929cf90 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -127,7 +127,7 @@ static void *alloc_insn_page(void)
127 127
128static void free_insn_page(void *page) 128static void free_insn_page(void *page)
129{ 129{
130 module_free(NULL, page); 130 module_memfree(page);
131} 131}
132 132
133struct kprobe_insn_cache kprobe_insn_slots = { 133struct kprobe_insn_cache kprobe_insn_slots = {
diff --git a/kernel/module.c b/kernel/module.c
index 68be0b1f9e7f..1f85fd5c89d3 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1795,7 +1795,7 @@ static void unset_module_core_ro_nx(struct module *mod) { }
1795static void unset_module_init_ro_nx(struct module *mod) { } 1795static void unset_module_init_ro_nx(struct module *mod) { }
1796#endif 1796#endif
1797 1797
1798void __weak module_free(struct module *mod, void *module_region) 1798void __weak module_memfree(void *module_region)
1799{ 1799{
1800 vfree(module_region); 1800 vfree(module_region);
1801} 1801}
@@ -1846,7 +1846,7 @@ static void free_module(struct module *mod)
1846 /* This may be NULL, but that's OK */ 1846 /* This may be NULL, but that's OK */
1847 unset_module_init_ro_nx(mod); 1847 unset_module_init_ro_nx(mod);
1848 module_arch_freeing_init(mod); 1848 module_arch_freeing_init(mod);
1849 module_free(mod, mod->module_init); 1849 module_memfree(mod->module_init);
1850 kfree(mod->args); 1850 kfree(mod->args);
1851 percpu_modfree(mod); 1851 percpu_modfree(mod);
1852 1852
@@ -1855,7 +1855,7 @@ static void free_module(struct module *mod)
1855 1855
1856 /* Finally, free the core (containing the module structure) */ 1856 /* Finally, free the core (containing the module structure) */
1857 unset_module_core_ro_nx(mod); 1857 unset_module_core_ro_nx(mod);
1858 module_free(mod, mod->module_core); 1858 module_memfree(mod->module_core);
1859 1859
1860#ifdef CONFIG_MPU 1860#ifdef CONFIG_MPU
1861 update_protections(current->mm); 1861 update_protections(current->mm);
@@ -2790,7 +2790,7 @@ static int move_module(struct module *mod, struct load_info *info)
2790 */ 2790 */
2791 kmemleak_ignore(ptr); 2791 kmemleak_ignore(ptr);
2792 if (!ptr) { 2792 if (!ptr) {
2793 module_free(mod, mod->module_core); 2793 module_memfree(mod->module_core);
2794 return -ENOMEM; 2794 return -ENOMEM;
2795 } 2795 }
2796 memset(ptr, 0, mod->init_size); 2796 memset(ptr, 0, mod->init_size);
@@ -2936,8 +2936,8 @@ static void module_deallocate(struct module *mod, struct load_info *info)
2936{ 2936{
2937 percpu_modfree(mod); 2937 percpu_modfree(mod);
2938 module_arch_freeing_init(mod); 2938 module_arch_freeing_init(mod);
2939 module_free(mod, mod->module_init); 2939 module_memfree(mod->module_init);
2940 module_free(mod, mod->module_core); 2940 module_memfree(mod->module_core);
2941} 2941}
2942 2942
2943int __weak module_finalize(const Elf_Ehdr *hdr, 2943int __weak module_finalize(const Elf_Ehdr *hdr,
@@ -3062,7 +3062,7 @@ static int do_init_module(struct module *mod)
3062#endif 3062#endif
3063 unset_module_init_ro_nx(mod); 3063 unset_module_init_ro_nx(mod);
3064 module_arch_freeing_init(mod); 3064 module_arch_freeing_init(mod);
3065 module_free(mod, mod->module_init); 3065 module_memfree(mod->module_init);
3066 mod->module_init = NULL; 3066 mod->module_init = NULL;
3067 mod->init_size = 0; 3067 mod->init_size = 0;
3068 mod->init_ro_size = 0; 3068 mod->init_ro_size = 0;