[Devel] [PATCH RHEL7 COMMIT] module: Fix load_module() error path

Konstantin Khorenko khorenko at virtuozzo.com
Fri Sep 15 17:27:38 MSK 2017


The commit is pushed to "branch-rh7-3.10.0-693.1.1.vz7.37.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.1.1.vz7.37.4
------>
commit 35062b91e08fda3dd589db23104226c38ffd1b9f
Author: Peter Zijlstra <peterz at infradead.org>
Date:   Fri Sep 15 17:27:38 2017 +0300

    module: Fix load_module() error path
    
    The load_module() error path frees a module but forgot to take it out
    of the mod_tree, leaving a dangling entry in the tree, causing havoc.
    
    Cc: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
    Reported-by: Arthur Marsh <arthur.marsh at internode.on.net>
    Tested-by: Arthur Marsh <arthur.marsh at internode.on.net>
    Fixes: 93c2e105f6bc ("module: Optimize __module_address() using a latched RB-tree")
    Signed-off-by: Peter Zijlstra (Intel) <peterz at infradead.org>
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
    
    https://jira.sw.ru/browse/PSBM-69081
    (cherry picked from commit 758556bdc1c8a8dffea0ea9f9df891878cc2468c)
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 kernel/module.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/module.c b/kernel/module.c
index 952a958..a5ee99f 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3643,6 +3643,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
 	mutex_lock(&module_mutex);
 	/* Unlink carefully: kallsyms could be walking list. */
 	list_del_rcu(&mod->list);
+	mod_tree_remove(mod);
 	wake_up_all(&module_wq);
 	mutex_unlock(&module_mutex);
  free_module:


More information about the Devel mailing list