[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>
Fri, 19 Apr 2024 18:32:03 +0000 (11:32 -0700)
commitc65185d40ef4d1f9ccb8dc80c8d84d033d4735d4
treee4dca87e1bb409c25bb4829991d7036aa07f3a27
parentc903ec43bb6c27be215aaa3052e4a1f149e23a11
[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