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>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 18 Feb 2021 20:59:00 +0800
From:   qiuguorui1 <qiuguorui1@...wei.com>
To:     <takahiro.akashi@...aro.org>, <catalin.marinas@....com>,
        <will@...nel.org>, <l.stelmach@...sung.com>, <lkml@....ORG>,
        <akpm@...ux-foundation.org>, <bgwin@...gle.com>, <rppt@...nel.org>,
        <gustavoars@...nel.org>, <tao.li@...o.com>, <james.morse@....com>
CC:     <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>, <zengweilin@...wei.com>,
        <liuwenliang@...wei.com>, <qiuguorui1@...wei.com>
Subject: [PATCH] arm64: kexec_file: fix memory leakage in create_dtb() when fdt_open_into() fails

in function create_dtb(), if fdt_open_into() fails, we need to vfree
buf before return.

Fixes: 52b2a8af74360 ("arm64: kexec_file: load initrd and device-tree")
Cc: stable@...r.kernel.org # v5.0
Signed-off-by: qiuguorui1 <qiuguorui1@...wei.com>
---
 arch/arm64/kernel/machine_kexec_file.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c
index 03210f644790..0cde47a63beb 100644
--- a/arch/arm64/kernel/machine_kexec_file.c
+++ b/arch/arm64/kernel/machine_kexec_file.c
@@ -182,8 +182,10 @@ static int create_dtb(struct kimage *image,
 
 		/* duplicate a device tree blob */
 		ret = fdt_open_into(initial_boot_params, buf, buf_size);
-		if (ret)
+		if (ret) {
+			vfree(buf);
 			return -EINVAL;
+		}
 
 		ret = setup_dtb(image, initrd_load_addr, initrd_len,
 				cmdline, buf);
-- 
2.12.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ