diff options
author | Artem Savkov <asavkov@redhat.com> | 2018-11-20 11:52:15 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-12-17 09:28:49 +0100 |
commit | de21975e71fe3fbb96b42fe6155d8a74fc74e4ca (patch) | |
tree | 086e06123cfa412aca9ae125c2766c7aafecce29 /tools/objtool | |
parent | 7d14117bd218a81f9f174af94b7c4f26aca16ad3 (diff) | |
download | linux-stable-de21975e71fe3fbb96b42fe6155d8a74fc74e4ca.tar.gz linux-stable-de21975e71fe3fbb96b42fe6155d8a74fc74e4ca.tar.bz2 linux-stable-de21975e71fe3fbb96b42fe6155d8a74fc74e4ca.zip |
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
elf_close().
Signed-off-by: Artem Savkov <asavkov@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 13810435b9a7 ("objtool: Support GCC 8's cold subfunctions")
Link: http://lkml.kernel.org/r/beac5a9b7da9e8be90223459dcbe07766ae437dd.1542736240.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/objtool')
-rw-r--r-- | tools/objtool/elf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 0d1acb704f64..3616d626991e 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -312,7 +312,7 @@ static int read_symbols(struct elf *elf) if (!pfunc) { WARN("%s(): can't find parent function", sym->name); - goto err; + return -1; } sym->pfunc = pfunc; |