]> Git Repo - J-linux.git/commitdiff
module: correctly exit module_kallsyms_on_each_symbol when fn() != 0
authorJon Mediero <[email protected]>
Thu, 20 May 2021 12:23:26 +0000 (14:23 +0200)
committerJessica Yu <[email protected]>
Wed, 26 May 2021 12:55:45 +0000 (14:55 +0200)
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]>
kernel/module.c

index faf9114a9981c19d55d8bfb133de88df9e7cded1..fdd6047728df838ba814653e78f94229685b2798 100644 (file)
@@ -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;
 }
This page took 0.056083 seconds and 4 git commands to generate.