* [PATCH] objtool: fix potential memory leak special_get_alts()
@ 2020-07-02 11:00 Chen Wandun
2020-07-02 11:05 ` Peter Zijlstra
0 siblings, 1 reply; 2+ messages in thread
From: Chen Wandun @ 2020-07-02 11:00 UTC (permalink / raw)
To: jpoimboe, peterz, linux-kernel; +Cc: chenwandun
If get_alt_entry() return error, struct special_alt will leak.
Fixes: 442f04c34a1a ("objtool: Add tool to perform compile-time stack metadata validation")
Signed-off-by: Chen Wandun <chenwandun@huawei.com>
---
tools/objtool/special.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/objtool/special.c b/tools/objtool/special.c
index e893f1e48e44..90a6ba2d5895 100644
--- a/tools/objtool/special.c
+++ b/tools/objtool/special.c
@@ -188,8 +188,10 @@ int special_get_alts(struct elf *elf, struct list_head *alts)
memset(alt, 0, sizeof(*alt));
ret = get_alt_entry(elf, entry, sec, idx, alt);
- if (ret)
+ if (ret) {
+ free(alt);
return ret;
+ }
list_add_tail(&alt->list, alts);
}
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-02 11:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02 11:00 [PATCH] objtool: fix potential memory leak special_get_alts() Chen Wandun
2020-07-02 11:05 ` Peter Zijlstra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®