[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, 2 Jan 2025 21:47:07 +0000 (13:47 -0800)
commit6e42c3c48d95a016c0d5b2402e8b796df105cc5f
treeb83dd11494192cde62150a14fc6ba58a658d411b
parent8d549a79ace2ca180d1a039bd664e4c83b3e2c60
[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