[PATCH 1/2] efi_loader: avoid pointer access after calling efi_delete_handle
authorMasahisa Kojima <masahisa.kojima@linaro.org>
Fri, 19 Jan 2024 00:45:44 +0000 (09:45 +0900)
committerVagrant Cascadian <vagrant@debian.org>
Thu, 9 Jan 2025 19:14:04 +0000 (11:14 -0800)
commit8638c755b8935e2392bb79870b1392290b23fec0
treee93776f077d10ebeb5a68219b95c8eedfcabd098
parented564b4130861cb5b2e979cc5e3f74ddc5424f8b
[PATCH 1/2] efi_loader: avoid pointer access after calling efi_delete_handle

efi_delete_handle() calls efi_purge_handle(), then it finally
frees the EFI handle.
Both diskobj and handle variables in efi_disk_remove() have
the same pointer, we can not access diskobj->dp after calling
efi_delete_handle().

This commit saves the struct efi_device_path pointer before
calling efi_delete_handle(). This commit also fixes the
missing free for volume member in struct efi_disk_obj.

This commit also removes the container_of() calls, and
adds the TODO comment of missing efi_close_protocol() call
for the parent EFI_BLOCK_IO_PROTOCOL.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Gbp-Pq: Topic riscv64
Gbp-Pq: Name efi_loader-avoid-pointer-access-after-calling-efi_de.patch
lib/efi_loader/efi_disk.c