diff options
author | Felix Fietkau <nbd@nbd.name> | 2017-02-15 12:33:03 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2017-02-15 12:35:17 +0100 |
commit | 1e1a0592f8309a8253e39d0f6a42193e60d80d23 (patch) | |
tree | cb55015e5d1f6d8e8643c88cf7cbaed400553231 /target/linux/generic/patches-4.9 | |
parent | 2a6fbce1218e7ed8ffaf997b1da03be244d744c9 (diff) | |
download | mtk-20170518-1e1a0592f8309a8253e39d0f6a42193e60d80d23.zip mtk-20170518-1e1a0592f8309a8253e39d0f6a42193e60d80d23.tar.gz mtk-20170518-1e1a0592f8309a8253e39d0f6a42193e60d80d23.tar.bz2 |
kernel: fix crashes on MIPS when loading kernel modules under memory pressure
When memory is tight, modules may need to be loaded into vmalloc()
space. The code then has to generate jump trampolines which enable
relocations between vmalloc space and physical address space.
The code had a bug that was freeing these trampolines even when the
module was successfully loaded.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'target/linux/generic/patches-4.9')
-rw-r--r-- | target/linux/generic/patches-4.9/305-mips_module_reloc.patch | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/target/linux/generic/patches-4.9/305-mips_module_reloc.patch b/target/linux/generic/patches-4.9/305-mips_module_reloc.patch index 997105b..1c2bd0a 100644 --- a/target/linux/generic/patches-4.9/305-mips_module_reloc.patch +++ b/target/linux/generic/patches-4.9/305-mips_module_reloc.patch @@ -315,7 +315,7 @@ return 0; } -@@ -349,9 +591,33 @@ int module_finalize(const Elf_Ehdr *hdr, +@@ -349,9 +591,36 @@ int module_finalize(const Elf_Ehdr *hdr, list_add(&me->arch.dbe_list, &dbe_list); spin_unlock_irq(&dbe_lock); } @@ -336,6 +336,9 @@ +void module_arch_freeing_init(struct module *mod) +{ ++ if (mod->state == MODULE_STATE_LIVE) ++ return; ++ + if (mod->arch.phys_plt_tbl) { + __module_free(mod->arch.phys_plt_tbl); + mod->arch.phys_plt_tbl = NULL; |