Commit 0b9301fb authored by Artem Savkov's avatar Artem Savkov Committed by Ingo Molnar

objtool: Fix double-free in .cold detection error path

If read_symbols() fails during second list traversal (the one dealing
with ".cold" subfunctions) it frees the symbol, but never deletes it
from the list/hash_table resulting in symbol being freed again in
elf_close(). Fix it by just returning an error, leaving cleanup to
elf_close().
Signed-off-by: default avatarArtem Savkov <asavkov@redhat.com>
Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 13810435 ("objtool: Support GCC 8's cold subfunctions")
Link: http://lkml.kernel.org/r/beac5a9b7da9e8be90223459dcbe07766ae437dd.1542736240.git.jpoimboe@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 9ff01193
...@@ -312,7 +312,7 @@ static int read_symbols(struct elf *elf) ...@@ -312,7 +312,7 @@ static int read_symbols(struct elf *elf)
if (!pfunc) { if (!pfunc) {
WARN("%s(): can't find parent function", WARN("%s(): can't find parent function",
sym->name); sym->name);
goto err; return -1;
} }
sym->pfunc = pfunc; sym->pfunc = pfunc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment