Skip to content

Commit 2c0f0f3

Browse files
Jon MedieroJessica Yu
authored andcommitted
module: correctly exit module_kallsyms_on_each_symbol when fn() != 0
Commit 013c166 ("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: 013c166 ("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]>
1 parent 02b2fb4 commit 2c0f0f3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/module.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4415,9 +4415,10 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
44154415
ret = fn(data, kallsyms_symbol_name(kallsyms, i),
44164416
mod, kallsyms_symbol_value(sym));
44174417
if (ret != 0)
4418-
break;
4418+
goto out;
44194419
}
44204420
}
4421+
out:
44214422
mutex_unlock(&module_mutex);
44224423
return ret;
44234424
}

0 commit comments

Comments
 (0)