mips: Free memory when load_module fails (#14453)
authorblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Tue, 7 Jul 2015 13:48:27 +0000 (13:48 +0000)
committerblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Tue, 7 Jul 2015 13:48:27 +0000 (13:48 +0000)
commit40505b89aea5d1e5c0571fd145992dabb9c4c59a
tree4f41b34c92bd1cfe7d3bf5d6a6dca4199ba148fb
parent7edbac04aeb3f5a59bdd2702a4b60f1235ee46ab
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@open-mesh.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@46247 3c298f89-4303-0410-b956-a3cf2f4a3e73
target/linux/generic/patches-3.18/099-module_arch_freeing_init-new-hook-for-archs-before-m.patch [new file with mode: 0644]
target/linux/generic/patches-3.18/305-mips_module_reloc.patch
target/linux/generic/patches-4.0/305-mips_module_reloc.patch
target/linux/generic/patches-4.1/305-mips_module_reloc.patch