aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Mediero <[email protected]>2021-05-20 14:23:26 +0200
committerJessica Yu <[email protected]>2021-05-26 14:55:45 +0200
commit2c0f0f3639562d6e38ee9705303c6457c4936eac (patch)
treeb9e995fcb120cd0f829983170af70997f5686a23
parent02b2fb455b2e80a0a831d067ab7ef950e2991eee (diff)
module: correctly exit module_kallsyms_on_each_symbol when fn() != 0
Commit 013c1667cf78 ("kallsyms: refactor {,module_}kallsyms_on_each_symbol") replaced the return inside the nested loop with a break, changing the semantics of the function: the break only exits the innermost loop, so the code continues iterating the symbols of the next module instead of exiting. Fixes: 013c1667cf78 ("kallsyms: refactor {,module_}kallsyms_on_each_symbol") Reviewed-by: Petr Mladek <[email protected]> Reviewed-by: Miroslav Benes <[email protected]> Signed-off-by: Jon Mediero <[email protected]> Signed-off-by: Jessica Yu <[email protected]>
-rw-r--r--kernel/module.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/module.c b/kernel/module.c
index faf9114a9981..fdd6047728df 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -4415,9 +4415,10 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
ret = fn(data, kallsyms_symbol_name(kallsyms, i),
mod, kallsyms_symbol_value(sym));
if (ret != 0)
- break;
+ goto out;
}
}
+out:
mutex_unlock(&module_mutex);
return ret;
}