Commit 63bc6364 authored by Artem Savkov's avatar Artem Savkov Committed by Greg Kroah-Hartman

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

[ Upstream commit 0b9301fb632f7111a3293a30cc5b20f1b82ed08d ]

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
Signed-off-by: default avatarArtem Savkov <>
Signed-off-by: default avatarJosh Poimboeuf <>
Cc: Linus Torvalds <>
Cc: Peter Zijlstra <>
Cc: Thomas Gleixner <>
Fixes: 13810435b9a7 ("objtool: Support GCC 8's cold subfunctions")
Link: default avatarIngo Molnar <>
Signed-off-by: default avatarSasha Levin <>
parent da7e373e
......@@ -312,7 +312,7 @@ static int read_symbols(struct elf *elf)
if (!pfunc) {
WARN("%s(): can't find parent function",
goto err;
return -1;
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