From patchwork Sat Oct 15 21:35:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 615228 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1119313pvb; Sat, 15 Oct 2022 14:36:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7+cSPKfHSjdUFc3kDWO1Ygj6ysaCSpeYi9rXMCXmNsFV+fcBQO2ZDVu3+dJwl5drvjLh+i X-Received: by 2002:a05:6402:114a:b0:454:85e4:2295 with SMTP id g10-20020a056402114a00b0045485e42295mr3893706edw.348.1665869760690; Sat, 15 Oct 2022 14:36:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665869760; cv=none; d=google.com; s=arc-20160816; b=vlXS/+DCcJBGU+tkQLjF7/7GjKRuNR8QGIAeyZ48eEIA98xiyKKNyGFe2nuweNzi7m elwZX1nhA800iPTnZXsd2omu5FBlMc3/vfKXFtJUMb1STWb5fbjkmZ9CSFZ4Z3A242ax 1dx2B49c4RKOGKX2BBUl8ui+zWV3NZQpGWBttEKYqZrmOVYd8gaa5YolBCn9nhcan+yK DiXj0QuAQdtUHwREwfdWTyhJcnOqhUfY21UFEiElHGYxG/HCSC1HSBWKgRNzNL+JEW2W hOg8Y7P69HU/viEnKwgN26SFXVIiguTYv4S0Jp42n6ZCu+Oyr2ulv7DhcyahimDRv/S5 Y6Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=hH+W9kzVBB+scsJyos3+pOAA2RfmqZnuFGjFva6hrEQ=; b=CcjhcRZUl3XW1eMfBqw/RGDbY2XYduWlyLl5F0DLe5w5Q5spEtDKo7RdSlUZfW+o4A 5rMTojZ6v3gwFdYevbuOd7JuWmziEmTAUVOqCPQK8WMahCPNpPMMns4FM+nzvVg0+Zle PAJZgcE9ddonmRqvVcnyhbYbyyYnDpr+FqvmpyoTh1UojJ3KGOC76twOahWyBJSqyoTw sZnFlJYJlv/ybP9oYxut8IIf8rhSgQYHxtVubj+ZlGPFkxY0kXSeKVvr6Ib+gHXlFJQr y3MWgKuEiKmtV722AFt+IOrYOVbKbMclFupwoW7zdB2/wAbY0uA8ki/DVF/txY+lcWJk LoTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S4mbYvxn; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id q4-20020a056402248400b0045c21f435dbsi5281334eda.521.2022.10.15.14.36.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Oct 2022 14:36:00 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S4mbYvxn; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C0A7B84D45; Sat, 15 Oct 2022 23:35:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="S4mbYvxn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 253D484D5E; Sat, 15 Oct 2022 23:35:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 198DE84C60 for ; Sat, 15 Oct 2022 23:35:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wr1-x433.google.com with SMTP id j7so12760843wrr.3 for ; Sat, 15 Oct 2022 14:35:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=hH+W9kzVBB+scsJyos3+pOAA2RfmqZnuFGjFva6hrEQ=; b=S4mbYvxnHgVKgH5YkIXC0sHccCxhQ0l2H5Rlg5jJSjnZc4mFNdfQjUQKu8LkdYMF61 Kt0BP3i6bjHvxa0FYSrjnI/CAYvTETNsKyb8tHwM8IHdB5HuYKwrSOTHQPlDXa/QLoeW 5LwWX2yah1rIEo+2f3OfpBVb0bTAHHn8TCb7Q2gEXfDvvNSq/XJZXFmGBPukAWI0nwml zjaKX8Jy4k+qH8GpDZdumLegKv3niQsNV5bQYbk8LpBgNcFAGgqqP52xpBgXxlH6+7kA 0AuBu94uLfXoaW7nL15vxkhKikfp3cVXh4oB3RsECq3SCIPtenhvJf2Np+O/K0cbZCZo qXJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hH+W9kzVBB+scsJyos3+pOAA2RfmqZnuFGjFva6hrEQ=; b=08jjYW1F5JAj77LK7vGdAVbL+5fkjwAJk8fQGLjtiAkkVeK+yauK3zvbyFMFnrjRkH g8cI9uoSila5/dBDMNfJGc1tt6DrLlHTML0eSNT+cdFXKK97I8X/uHyiBsRoyjipdCpe RM0zKwy1BWFXmBlBj14JR3t0LRPk0FPQiNXDdbn2BWHN5/2dxIX8MxEyhIyLf/juXnsG 6XdvKIN4hH7wHZ1RvCFKpfJJ9jzZYrwZhMflETTv16Uyt1AWVxdahGpy0fi/lAtaHE9/ iYBn2CwWkyHfFFEZIcgBug5l8wijHJnYO3xs7qseChZSlBe6TRAZl02+NKgFfyPdPo6w h6Kg== X-Gm-Message-State: ACrzQf3Zoitfix9TnxatphXzLxJlXQ6Wm+3F5G1J0oFDDhSnOETLF7lt FVtmZHihwwug7TwERhMJXRAV3HdWZMs04Q== X-Received: by 2002:a05:6000:15c3:b0:230:f9fb:c7d with SMTP id y3-20020a05600015c300b00230f9fb0c7dmr2431743wry.250.1665869752574; Sat, 15 Oct 2022 14:35:52 -0700 (PDT) Received: from localhost.localdomain (ppp046103015185.access.hol.gr. [46.103.15.185]) by smtp.gmail.com with ESMTPSA id v2-20020a5d4b02000000b0022ed6ff3a96sm4880924wrq.39.2022.10.15.14.35.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Oct 2022 14:35:52 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: heinrich.schuchardt@canonical.com, Ilias Apalodimas , Heinrich Schuchardt Subject: [PATCH] efi_loader: remove efi_delete_handle on loadfile2 Date: Sun, 16 Oct 2022 00:35:34 +0300 Message-Id: <20221015213534.216607-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Loadfile2 code is installing two protocols on it's own handle and uses efi_delete_handle() to clean it up on failure(s). However commit 05c4c9e21ae6 ("efi_loader: define internal implementations of install/uninstallmultiple") prepares the ground for us to clean up efi_elete_handle() used in favor of Install/UninstallMultipleProtocol Signed-off-by: Ilias Apalodimas Reviewed-by: Heinrich Schuchardt --- cmd/bootefi.c | 6 ++++-- include/efi_loader.h | 2 +- lib/efi_loader/efi_load_initrd.c | 17 ++++++++++++++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index b93c0d3d4c02..2a7d42925d65 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -394,8 +394,10 @@ static efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options) out: free(load_options); - if (IS_ENABLED(CONFIG_EFI_LOAD_FILE2_INITRD)) - efi_initrd_deregister(); + if (IS_ENABLED(CONFIG_EFI_LOAD_FILE2_INITRD)) { + if (efi_initrd_deregister() != EFI_SUCCESS) + log_err("Failed to remove loadfile2 for initrd\n"); + } /* Control is returned to U-Boot, disable EFI watchdog */ efi_set_watchdog(0); diff --git a/include/efi_loader.h b/include/efi_loader.h index 1bac3f49a3e5..0c6c95ba4641 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -570,7 +570,7 @@ efi_status_t efi_net_register(void); /* Called by bootefi to make the watchdog available */ efi_status_t efi_watchdog_register(void); efi_status_t efi_initrd_register(void); -void efi_initrd_deregister(void); +efi_status_t efi_initrd_deregister(void); /* Called by bootefi to make SMBIOS tables available */ /** * efi_acpi_register() - write out ACPI tables diff --git a/lib/efi_loader/efi_load_initrd.c b/lib/efi_loader/efi_load_initrd.c index 87fde3f88c2b..7a345d3fe41e 100644 --- a/lib/efi_loader/efi_load_initrd.c +++ b/lib/efi_loader/efi_load_initrd.c @@ -227,11 +227,22 @@ efi_status_t efi_initrd_register(void) * * Return: status code */ -void efi_initrd_deregister(void) +efi_status_t efi_initrd_deregister(void) { + efi_status_t ret; + if (!efi_initrd_handle) - return; + return EFI_SUCCESS; - efi_delete_handle(efi_initrd_handle); + ret = efi_uninstall_multiple_protocol_interfaces(efi_initrd_handle, + /* initramfs */ + &efi_guid_device_path, + &dp_lf2_handle, + /* LOAD_FILE2 */ + &efi_guid_load_file2_protocol, + (void *)&efi_lf2_protocol, + NULL); efi_initrd_handle = NULL; + + return ret; }