Changeset 47004


Ignore:
Timestamp:
2015-09-18T14:47:46+02:00 (2 years ago)
Author:
nbd
Message:

mips: Free memory when load_module fails (#14453)

The mips reloc patch introduced new allocations which were done before
add_unformed_module but never freed them in case of an error. A new hook in
Linux 3.19 called module_arch_freeing_init can be used for freeing memory
which were allocated during this init phase.

The problem can be seen when trying to load a module (via busybox insmod)
when it was already loaded.

free -m
for i in seq 1 100; do

/sbin/insmod /lib/modules/*/ath9k.ko >& /dev/null

done
free -m

This simple loop would leak ~3.2 MB.

Signed-off-by: Sven Eckelmann <sven@…>

Backport of r46247

Location:
branches/chaos_calmer/target/linux/generic/patches-3.18
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/chaos_calmer/target/linux/generic/patches-3.18/305-mips_module_reloc.patch

    r45385 r47004  
    318318        return 0; 
    319319 } 
    320 @@ -287,11 +529,32 @@ int module_finalize(const Elf_Ehdr *hdr, 
     320@@ -287,9 +529,33 @@ int module_finalize(const Elf_Ehdr *hdr, 
    321321                list_add(&me->arch.dbe_list, &dbe_list); 
    322322                spin_unlock_irq(&dbe_lock); 
     
    337337 } 
    338338  
    339  void module_arch_cleanup(struct module *mod) 
    340  { 
     339+void module_arch_freeing_init(struct module *mod) 
     340+{ 
    341341+       if (mod->arch.phys_plt_tbl) { 
    342342+               __module_free(mod->arch.phys_plt_tbl); 
     
    347347+               mod->arch.virt_plt_tbl = NULL; 
    348348+       } 
    349 + 
     349+} 
     350+ 
     351 void module_arch_cleanup(struct module *mod) 
     352 { 
    350353        spin_lock_irq(&dbe_lock); 
    351         list_del(&mod->arch.dbe_list); 
    352         spin_unlock_irq(&dbe_lock); 
Note: See TracChangeset for help on using the changeset viewer.