summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2019-05-05 10:37:51 +0200
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2019-05-07 21:10:04 +0200
commitec163faa1b7e0314ae5703c7c2203b1615e78c88 (patch)
tree87ba2cbeaa7bc42fd7e2043aafcc876a43d4bc04 /lib
parent24f6be7ada05f24f18aec6651dd393e82136342a (diff)
efi_loader: CloseProtocol() requires valid agent handle
Return EFI_INVALID_PARAMETER from CloseProtcol() if the agent handle is not valid. Return EFI_INVALID_PARAMETER if the optional controller handle is not valid. Return immediately from efi_search_obj if the handle is NULL. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_boottime.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 194df5a180d..967b39b223c 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -971,11 +971,13 @@ struct efi_object *efi_search_obj(const efi_handle_t handle)
{
struct efi_object *efiobj;
+ if (!handle)
+ return NULL;
+
list_for_each_entry(efiobj, &efi_obj_list, link) {
if (efiobj == handle)
return efiobj;
}
-
return NULL;
}
@@ -1982,7 +1984,8 @@ static efi_status_t EFIAPI efi_close_protocol(efi_handle_t handle,
EFI_ENTRY("%p, %pUl, %p, %p", handle, protocol, agent_handle,
controller_handle);
- if (!agent_handle) {
+ if (!efi_search_obj(agent_handle) ||
+ (controller_handle && !efi_search_obj(controller_handle))) {
r = EFI_INVALID_PARAMETER;
goto out;
}