[PATCH 3/5] efi_loader: disconnect all controllers when uninstalling a protocol

Heinrich Schuchardt xypron.glpk at gmx.de
Mon Jun 19 09:03:58 CEST 2023


On 6/15/23 16:39, Ilias Apalodimas wrote:
> When we are trying to uninstall a protocol interface from a controller
> handle we are trying to disconnect drivers related to that protocol.
> However, when we call efi_disconnect_all_drivers() we pass the protocol
> GUID.  If 2 different drivers are using the same protocol interface and
> one of them can't be stopped (e.g by returning EFI_DEVICE_ERROR) we
> should stop uninstalling it.
>
> Instead of explicitly passing the protocol GUID, pass NULL as an argument.
> That will force efi_get_drivers() to return all drivers consuming the
> interface regardless of the protocol GUID.
> While at it call efi_disconnect_all_drivers() with a handle instead of
> the efiobj
>
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> ---
>   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 df675d0ad488..b148824c7ec5 100644
> --- a/lib/efi_loader/efi_boottime.c
> +++ b/lib/efi_loader/efi_boottime.c
> @@ -1374,7 +1374,7 @@ static efi_status_t efi_uninstall_protocol
>   	if (r != EFI_SUCCESS)
>   		goto out;
>   	/* Disconnect controllers */
> -	r = efi_disconnect_all_drivers(efiobj, protocol, NULL);
> +	r = efi_disconnect_all_drivers(handle, NULL, NULL);

When uninstalling a *single* protocol we don't want to disconnect
drivers for *all* protocols on this handle but only for the specified
one. This will not work if you don't pass the protocol GUID to
DisconnectController().

Best regards

Heinrich

>   	if (r != EFI_SUCCESS) {
>   		r = EFI_DEVICE_ERROR;
>   		goto out;
> --
> 2.39.2
>



More information about the U-Boot mailing list