]> git.dujemihanovic.xyz Git - u-boot.git/commit
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)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sun, 21 Jan 2024 10:24:24 +0000 (11:24 +0100)
commitf674a2f9a9f9c28fddde53f0a0b2f3e3c3b342ee
tree55c89834535660371898ede5673d00638ed1060c
parent3f7822bf9f03e6decb8e698fb4f9ac31d23725f7
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>
lib/efi_loader/efi_disk.c