Skip to content
Snippets Groups Projects
Commit 656d1d58 authored by qiuguorui1's avatar qiuguorui1 Committed by Will Deacon
Browse files

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: 52b2a8af ("arm64: kexec_file: load initrd and device-tree")
Cc: stable@vger.kernel.org # v5.0
Signed-off-by: default avatarqiuguorui1 <qiuguorui1@huawei.com>
Link: https://lore.kernel.org/r/20210218125900.6810-1-qiuguorui1@huawei.com


Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent a2c42bba
No related branches found
No related tags found
No related merge requests found
...@@ -182,8 +182,10 @@ static int create_dtb(struct kimage *image, ...@@ -182,8 +182,10 @@ static int create_dtb(struct kimage *image,
/* duplicate a device tree blob */ /* duplicate a device tree blob */
ret = fdt_open_into(initial_boot_params, buf, buf_size); ret = fdt_open_into(initial_boot_params, buf, buf_size);
if (ret) if (ret) {
vfree(buf);
return -EINVAL; return -EINVAL;
}
ret = setup_dtb(image, initrd_load_addr, initrd_len, ret = setup_dtb(image, initrd_load_addr, initrd_len,
cmdline, buf); cmdline, buf);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment