We are missing a call to EFI_EXIT() when returning from efi_disconnect_controller(), which we need after having called EFI_ENTRY().
Fix this by jumping to the common error path, which does call EFI_EXIT(). Even though the common error path may try to free child_handle_buffer, this cannot harm in our case as it always NULL. This is inspired by a barebox fix. [1] Link: https://git.pengutronix.de/cgit/barebox/commit/?id=080db65e39a877b000baaf843c997a69821dfe69 [1] Fixes: 314bed6c854e ("efi_loader: fix DisconnectController() for sole child") Signed-off-by: Vincent Stehlé <[email protected]> Cc: Heinrich Schuchardt <[email protected]> Cc: Ilias Apalodimas <[email protected]> Cc: Tom Rini <[email protected]> --- Changes for v2: - Drop the return and jump to the common error path with a goto instead lib/efi_loader/efi_boottime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index de57823bd44..bcb01c92cf4 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -3895,7 +3895,7 @@ efi_status_t EFIAPI efi_disconnect_controller( &number_of_children, &child_handle_buffer); if (r != EFI_SUCCESS) - return r; + goto out; sole_child = (number_of_children == 1); if (child_handle) { -- 2.53.0

