mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2025-02-03 05:12:51 +00:00
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>
This commit is contained in:
parent
df49e49bc7
commit
853bad5af2
@ -317,7 +317,7 @@
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -287,9 +529,33 @@ int module_finalize(const Elf_Ehdr *hdr,
|
||||
@@ -287,9 +529,36 @@ int module_finalize(const Elf_Ehdr *hdr,
|
||||
list_add(&me->arch.dbe_list, &dbe_list);
|
||||
spin_unlock_irq(&dbe_lock);
|
||||
}
|
||||
@ -338,6 +338,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;
|
||||
|
@ -316,7 +316,7 @@
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -287,9 +528,33 @@ int module_finalize(const Elf_Ehdr *hdr,
|
||||
@@ -287,9 +528,36 @@ int module_finalize(const Elf_Ehdr *hdr,
|
||||
list_add(&me->arch.dbe_list, &dbe_list);
|
||||
spin_unlock_irq(&dbe_lock);
|
||||
}
|
||||
@ -337,6 +337,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;
|
||||
|
Loading…
Reference in New Issue
Block a user