diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2018-01-11 10:15:59 +0300 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2018-01-23 01:09:13 +0300 |
commit | 3b8a489c9f9c4fd9c4c02a7fd8e76017b027ec94 (patch) | |
tree | 27159e20a79bc3b60a002a8264c54e7c07aec6bd | |
parent | 191a41cc3295f1f468f70fe52b4b2ec93992abce (diff) | |
download | u-boot-3b8a489c9f9c4fd9c4c02a7fd8e76017b027ec94.tar.xz |
efi_loader: open_info in CloseProtocol
efi_open_protocol and efi_close_protocol have to keep track of
opened protocols.
Check if the protocol was opened for the same agent and
controller.
Remove all open protocol information for this pair.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r-- | lib/efi_loader/efi_boottime.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index ce3ae23057..f8cc318074 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1695,9 +1695,33 @@ static efi_status_t EFIAPI efi_close_protocol(void *handle, void *agent_handle, void *controller_handle) { + struct efi_handler *handler; + struct efi_open_protocol_info_item *item; + struct efi_open_protocol_info_item *pos; + efi_status_t r; + EFI_ENTRY("%p, %pUl, %p, %p", handle, protocol, agent_handle, controller_handle); - return EFI_EXIT(EFI_NOT_FOUND); + + if (!agent_handle) { + r = EFI_INVALID_PARAMETER; + goto out; + } + r = efi_search_protocol(handle, protocol, &handler); + if (r != EFI_SUCCESS) + goto out; + + r = EFI_NOT_FOUND; + list_for_each_entry_safe(item, pos, &handler->open_infos, link) { + if (item->info.agent_handle == agent_handle && + item->info.controller_handle == controller_handle) { + efi_delete_open_info(item); + r = EFI_SUCCESS; + break; + } + } +out: + return EFI_EXIT(r); } /* |