lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Fri, 25 Oct 2019 05:06:08 -0400
From:   Hewenliang <hewenliang4@...wei.com>
To:     <jpoimboe@...hat.com>, <peterz@...radead.org>, <mingo@...nel.org>,
        <linux-kernel@...r.kernel.org>
CC:     <linfeilong@...wei.com>, <hewenliang4@...wei.com>
Subject: [PATCH] objtool: Fix memory leakage in special_get_alts

special_get_alts just returns without releasing the memory which is
pointed by alt When get_alt_entry returns -1. It will cause the leakage
of memory. We should free the memory before special_get_alts returns
because of error.

Fixes: 442f04c34a1a ("objtool: Add tool to perform compile-time stack metadata validation")
Signed-off-by: Hewenliang <hewenliang4@...wei.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 fdbaa611146d..019ce8ecc101 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.19.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ