1
0
Fork 0
mirror of https://github.com/u-boot/u-boot.git synced 2025-04-25 23:06:15 +00:00

efi_loader: fix the return codes of UninstallProtocol

Up to now we did not check the return value of DisconnectController.
A previous patch is fixing that taking into account what happened during
the controller disconnect.  But that check takes place before our code
is trying to figure out if the interface exists to begin with.  In case a
driver is not allowed to unbind -- e.g returning EFI_DEVICE_ERROR, we
will end up returning that error instead of EFI_NOT_FOUND.

Add an extra check on the top of the function to make sure the protocol
interface exists before trying to disconnect any drivers

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
Ilias Apalodimas 2023-06-20 09:19:30 +03:00 committed by Heinrich Schuchardt
parent 747d16d93c
commit 748cb553ff

View file

@ -1373,6 +1373,8 @@ static efi_status_t efi_uninstall_protocol
r = efi_search_protocol(handle, protocol, &handler);
if (r != EFI_SUCCESS)
goto out;
if (handler->protocol_interface != protocol_interface)
return EFI_NOT_FOUND;
/* Disconnect controllers */
r = efi_disconnect_all_drivers(efiobj, protocol, NULL);
if (r != EFI_SUCCESS) {