mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 20:24:12 +08:00
efi: libstub: only free priv.runtime_map when allocated
priv.runtime_map is only allocated when efi_novamap is not set.
Otherwise, it is an uninitialized value. In the error path, it is freed
unconditionally. Avoid passing an uninitialized value to free_pool.
Free priv.runtime_map only when it was allocated.
This bug was discovered and resolved using Coverity Static Analysis
Security Testing (SAST) by Synopsys, Inc.
Fixes: f80d26043a
("efi: libstub: avoid efi_get_memory_map() for allocating the virt map")
Cc: <stable@vger.kernel.org>
Signed-off-by: Hagar Hemdan <hagarhem@amazon.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
parent
cda30c6542
commit
4b2543f7e1
@ -335,8 +335,8 @@ fail_free_new_fdt:
|
||||
|
||||
fail:
|
||||
efi_free(fdt_size, fdt_addr);
|
||||
|
||||
efi_bs_call(free_pool, priv.runtime_map);
|
||||
if (!efi_novamap)
|
||||
efi_bs_call(free_pool, priv.runtime_map);
|
||||
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user