summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorxypron.glpk@gmx.de <xypron.glpk@gmx.de>2017-07-11 20:06:17 (GMT)
committerAlexander Graf <agraf@suse.de>2017-07-19 12:14:38 (GMT)
commit4b6ed0d7a1d915524dd1ecccf023d519d7022a49 (patch)
tree27aa2167ff76c8342354c1ac87178bdc6d5133d6 /lib
parente0549f8a174be5cf9526ec2d072cadc17a54a3e5 (diff)
downloadu-boot-fsl-qoriq-4b6ed0d7a1d915524dd1ecccf023d519d7022a49.tar.xz
efi_loader: implement UninstallProtocolInterface
Without the patch efi_uninstall_protocol_interface always returns an error. With the patch protocols without interface can be uninstalled. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_boottime.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index a6325ba..0ad7ade 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -371,8 +371,44 @@ static efi_status_t EFIAPI efi_reinstall_protocol_interface(void *handle,
static efi_status_t EFIAPI efi_uninstall_protocol_interface(void *handle,
efi_guid_t *protocol, void *protocol_interface)
{
+ struct list_head *lhandle;
+ int i;
+ efi_status_t r = EFI_NOT_FOUND;
+
EFI_ENTRY("%p, %p, %p", handle, protocol, protocol_interface);
- return EFI_EXIT(EFI_NOT_FOUND);
+
+ if (!handle || !protocol) {
+ r = EFI_INVALID_PARAMETER;
+ goto out;
+ }
+
+ list_for_each(lhandle, &efi_obj_list) {
+ struct efi_object *efiobj;
+ efiobj = list_entry(lhandle, struct efi_object, link);
+
+ if (efiobj->handle != handle)
+ continue;
+
+ for (i = 0; i < ARRAY_SIZE(efiobj->protocols); i++) {
+ struct efi_handler *handler = &efiobj->protocols[i];
+ const efi_guid_t *hprotocol = handler->guid;
+
+ if (!hprotocol)
+ continue;
+ if (!guidcmp(hprotocol, protocol)) {
+ if (handler->protocol_interface) {
+ r = EFI_ACCESS_DENIED;
+ } else {
+ handler->guid = 0;
+ r = EFI_SUCCESS;
+ }
+ goto out;
+ }
+ }
+ }
+
+out:
+ return EFI_EXIT(r);
}
static efi_status_t EFIAPI efi_register_protocol_notify(efi_guid_t *protocol,
@@ -813,7 +849,7 @@ static efi_status_t EFIAPI efi_open_protocol(
struct efi_handler *handler = &efiobj->protocols[i];
const efi_guid_t *hprotocol = handler->guid;
if (!hprotocol)
- break;
+ continue;
if (!guidcmp(hprotocol, protocol)) {
if (attributes !=
EFI_OPEN_PROTOCOL_TEST_PROTOCOL) {