Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19393412 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull module and param fixes from Rusty Russell:
 "Surprising number of fixes this merge window :(

  The first two are minor fallout from the param rework which went in
  this merge window.

  The next three are a series which fixes a longstanding (but never
  previously reported and unlikely , so no CC stable) race between
  kallsyms and freeing the init section.

  Finally, a minor cleanup as our module refcount will now be -1 during
  unload"

* tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
  module: make module_refcount() a signed integer.
  module: fix race in kallsyms resolution during module load success.
  module: remove mod arg from module_free, rename module_memfree().
  module_arch_freeing_init(): new hook for archs before module->module_init freed.
  param: fix uninitialized read with CONFIG_DEBUG_LOCK_ALLOC
  param: initialize store function to NULL if not available.
parents b942c653 d5db139a
Loading
Loading
Loading
Loading
+1 −12
Original line number Diff line number Diff line
@@ -19,12 +19,10 @@
#include <linux/moduleloader.h>
#include <linux/vmalloc.h>

void module_free(struct module *mod, void *module_region)
void module_arch_freeing_init(struct module *mod)
{
	vfree(mod->arch.syminfo);
	mod->arch.syminfo = NULL;

	vfree(module_region);
}

static inline int check_rela(Elf32_Rela *rela, struct module *module,
@@ -291,12 +289,3 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,

	return ret;
}

int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
		    struct module *module)
{
	vfree(module->arch.syminfo);
	module->arch.syminfo = NULL;

	return 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ void *module_alloc(unsigned long size)
}

/* Free memory returned from module_alloc */
void module_free(struct module *mod, void *module_region)
void module_memfree(void *module_region)
{
	kfree(module_region);
}
+2 −4
Original line number Diff line number Diff line
@@ -305,14 +305,12 @@ plt_target (struct plt_entry *plt)
#endif /* !USE_BRL */

void
module_free (struct module *mod, void *module_region)
module_arch_freeing_init (struct module *mod)
{
	if (mod && mod->arch.init_unw_table &&
	    module_region == mod->module_init) {
	if (mod->arch.init_unw_table) {
		unw_remove_unwind_table(mod->arch.init_unw_table);
		mod->arch.init_unw_table = NULL;
	}
	vfree(module_region);
}

/* Have we already seen one of these relocations? */
+1 −1
Original line number Diff line number Diff line
@@ -1388,7 +1388,7 @@ void bpf_jit_compile(struct bpf_prog *fp)
void bpf_jit_free(struct bpf_prog *fp)
{
	if (fp->jited)
		module_free(NULL, fp->bpf_func);
		module_memfree(fp->bpf_func);

	bpf_prog_unlock_free(fp);
}
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ void *module_alloc(unsigned long size)
}

/* Free memory returned from module_alloc */
void module_free(struct module *mod, void *module_region)
void module_memfree(void *module_region)
{
	kfree(module_region);
}
Loading