efi_loader: HandleProtocol parameter checks
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sun, 5 May 2019 09:24:53 +0000 (11:24 +0200)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Tue, 7 May 2019 19:10:04 +0000 (21:10 +0200)
HandleProtocol() and OpenProtocol() have to return EFI_UNSUPPORTED if the
protocol is not installed on the handle.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
lib/efi_loader/efi_boottime.c

index ab299aa17f5d455b69739ce793eef2fdd32d516f..6d86dafc1655c87d8e2615dd1c5d36e17c9755ab 100644 (file)
@@ -2636,8 +2636,15 @@ static efi_status_t EFIAPI efi_open_protocol
        }
 
        r = efi_search_protocol(handle, protocol, &handler);
-       if (r != EFI_SUCCESS)
+       switch (r) {
+       case EFI_SUCCESS:
+               break;
+       case EFI_NOT_FOUND:
+               r = EFI_UNSUPPORTED;
                goto out;
+       default:
+               goto out;
+       }
 
        r = efi_protocol_open(handler, protocol_interface, agent_handle,
                              controller_handle, attributes);