[Devel] [PATCH RHEL7 COMMIT] module: fix memory leak in free_module

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jul 26 11:23:18 MSK 2017


The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.33.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.26.1.vz7.33.17
------>
commit cfedd05b9a819a7dd543aa252c61395cd17e6afc
Author: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Date:   Wed Jul 26 12:23:18 2017 +0400

    module: fix memory leak in free_module
    
    Reported by kmemleak:
    
      comm "systemd-udevd", pid 436, jiffies 4294689313 (age 1166.192s)
      hex dump (first 32 bytes):
        00 01 00 00 00 00 ad de 00 02 00 00 00 00 ad de  ................
        80 c1 55 a0 ff ff ff ff 00 00 00 00 00 00 00 00  ..U.............
      backtrace:
        [<ffffffff8167886e>] kmemleak_alloc+0x4e/0xb0
        [<ffffffff811f29f9>] kmem_cache_alloc_trace+0xe9/0x260
        [<ffffffff8110e10e>] load_module+0x35e/0x1be0
        [<ffffffff8110fb36>] SyS_finit_module+0xa6/0xd0
        [<ffffffff81694a89>] system_call_fastpath+0x16/0x1b
        [<ffffffffffffffff>] 0xffffffffffffffff
    
    In the scope of https://jira.sw.ru/browse/PSBM-65033
    
    Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 kernel/module.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/module.c b/kernel/module.c
index dfccff9..298a6d7 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1986,6 +1986,7 @@ static void free_module(struct module *mod)
 	mod_ext = find_module_ext(mod);
 	list_del(&mod_ext->next);
 	mutex_unlock(&module_ext_mutex);
+	kfree(mod_ext);
 
 	/* This may be NULL, but that's OK */
 	unset_module_init_ro_nx(mod);


More information about the Devel mailing list