From patchwork Mon Jun 19 11:14:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 694011 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d91:0:0:0:0:0 with SMTP id b17csp2316396wru; Mon, 19 Jun 2023 04:14:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ONHiu5gnPiQOGeHuFWxIFb0CjC6L3n0miAcdkCIuy7VefwsPouF+UJaAVT0LGEmGOwJMA X-Received: by 2002:a05:6a20:6a27:b0:10f:8b61:197c with SMTP id p39-20020a056a206a2700b0010f8b61197cmr571107pzk.54.1687173296989; Mon, 19 Jun 2023 04:14:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687173296; cv=none; d=google.com; s=arc-20160816; b=CkHA6rINzVlQ+RR+o8QXc9Rf7750Wv07p2AfvZYDSVKrlNzJgSq/9SKWZhSpikbihX E/SpqnmvC7CJoPtd5ts97lPzMykLGgeOPZjvx0Y2ANTfGFZPcMX2C7AvGKsk0S6zcAqf +B5Sb0nKZnLOeH3cxZ8HNLK/3ExrbikC4JAw3l06ll89RZq1qlpvfD9iuGJe2vvASsAe p7vB+R+u6w8KkjiEK4z2ju/pGAPyhGPKC3CPR4hx//VH2ulhHP+Lqh9lLN8CzJ35wdta NRjo2YSso+uR5JF7hy3dkTQ7283tQBHfoof9IzKz/Ms5MgPH9fKAMUc2ZRx7gnWZ+PAc CTCA== 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=OklOQsZokDZRcPl4Ssh1Mf0axmehnX9pelTCza0dPGw=; b=YXYyyzhkfJHrTY+gfMVOrDdJE4fIE4XFPsHF1FcHXV/t1dDAfKMtfJXbQB7DaJkgM7 4GA0SfKwmeVSZ4FUQ5qTxoaXd3FW8mJCNJ/5KeesbiaeV+QnIxyPEOVuq79490curteS uCBZ6J8Vu8waN37/S5g0iXxjE9npqdYlGFQSkp5Mt4+EnNUo9XiSzCmGUSlH57GG+ddi kaC+YToc2tn2IW8OlAFlm8s4uYtqLsyO+WlsdA5sFcnUppx15ed2gcURePCu78xJzw1r Y4Nvxk4HXGAi76GNgOESr6sntc9wWnKp6qWgKvu93so53Wbe9pDvzCL5m3F7Xv4gSAsO fvbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JwZah1Vs; 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 u71-20020a63854a000000b0054ff9032e5asi9255649pgd.179.2023.06.19.04.14.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 04:14:56 -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=JwZah1Vs; 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 652A2856A7; Mon, 19 Jun 2023 13:14:45 +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="JwZah1Vs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1D9938628C; Mon, 19 Jun 2023 13:14:31 +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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (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 2938784796 for ; Mon, 19 Jun 2023 13:14:08 +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-x42b.google.com with SMTP id ffacd0b85a97d-3112f2b9625so1718578f8f.1 for ; Mon, 19 Jun 2023 04:14:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687173247; x=1689765247; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=OklOQsZokDZRcPl4Ssh1Mf0axmehnX9pelTCza0dPGw=; b=JwZah1VsYkcQL7TyclrcBMlQI94T/Pu65YK4WioK23BOxUQNbbZkZ950jZj7XgLhFq 2P7RHBWjSpq60WxQdz9VlkUvvTrQ+JZWbYBXvj9xvWmUopR+PwUbIqArKSwmM8n0A4uA PHkg++qM4YF/e4ptAJbmtq62zhSOpnfbbG+XTA7Ki51KURaOXVuWq33sf55wi2rwXX8p 08on1X5vxr/W4p6TXiML2mIeqllJXROim32hZNYP1xfyTV7MVg/O5+RaVEERoszqs1pv gifjH+NKhBX7J9/ri/hcyW36bLTq7I2DPorEm+gIRKIYG4UzennNgiC9AwFmxGCLKDix AVxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687173247; x=1689765247; 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=OklOQsZokDZRcPl4Ssh1Mf0axmehnX9pelTCza0dPGw=; b=Ra9CU72Wx1b1pvfSwmnGqpC3OXfUZy5m2NdYDCcEcUeO/PEWdHL1KCKO5y5OC/dUgy ILrVfIHfFMEF68eAGRbQNOvc+g5mlLhjELz5fuQErirpDD1V5crsZwrqUHAAH+kWaq9w jhRWQogixdQE5InLpa2Orl4eMXb9dDPE1Dsw6F5HPsByEQdMIYaI272hE5nRLPNut40G LnxIgxyaRFVUmGflnAhp6oU646TXNEIX/fzPUX6PZEszPNE/P++FxdU2lC2hxxj9mdjD gX/qEMlCmQuDBMlIHwHxz/iwsVd/S1KyDLaIAYnnwle91juMNMMMaE55QKehCsagqtAh OZ+w== X-Gm-Message-State: AC+VfDwdghT9hisE0sUFwpuagAdW4tJQk+be/vwEct+NOR3Wiz1bVNLw FWTfBerlQC8btKZsm+jexGQinwItgc/lYZ8pK0BKJA== X-Received: by 2002:adf:e8c8:0:b0:30a:e9a9:a4e4 with SMTP id k8-20020adfe8c8000000b0030ae9a9a4e4mr6334131wrn.51.1687173247399; Mon, 19 Jun 2023 04:14:07 -0700 (PDT) Received: from localhost.localdomain (ppp089210114029.access.hol.gr. [89.210.114.29]) by smtp.gmail.com with ESMTPSA id y5-20020a056000108500b00311339f5b06sm5129727wrw.57.2023.06.19.04.14.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 04:14:07 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt Subject: [PATCH 1/2 v2] efi_loader: use efi_install_multiple_protocol_interfaces() Date: Mon, 19 Jun 2023 14:14:02 +0300 Message-Id: <20230619111403.51126-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.40.1 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.8 at phobos.denx.de X-Virus-Status: Clean The TCG2 protocol currently adds and removes protocols with efi_(add/remove)_protocol(). Removing protocols with efi_remove_protocol() might prove problematic since it doesn't call DisconnectController() when uninstalling the protocol and does not comply with the UEFI specification. It's also beneficial for readability to have protocol installations and removals in pairs -- IOW when efi_install_multiple_protocol_interfaces() is called, efi_uninstall_multiple_protocol_interfaces() should be used to remove it. So let's swap the efi_add_protocol() as well. Signed-off-by: Ilias Apalodimas --- Changes since v1: - Add a proper justification on the commit message lib/efi_loader/efi_tcg2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.40.1 diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index a83ae7a46cf3..49f8a5e77cbf 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -1680,8 +1680,8 @@ void tcg2_uninit(void) if (!is_tcg2_protocol_installed()) return; - ret = efi_remove_protocol(efi_root, &efi_guid_tcg2_protocol, - (void *)&efi_tcg2_protocol); + ret = efi_uninstall_multiple_protocol_interfaces(efi_root, &efi_guid_tcg2_protocol, + &efi_tcg2_protocol, NULL); if (ret != EFI_SUCCESS) log_err("Failed to remove EFI TCG2 protocol\n"); } @@ -2507,8 +2507,8 @@ efi_status_t efi_tcg2_register(void) goto fail; } - ret = efi_add_protocol(efi_root, &efi_guid_tcg2_protocol, - (void *)&efi_tcg2_protocol); + ret = efi_install_multiple_protocol_interfaces(&efi_root, &efi_guid_tcg2_protocol, + &efi_tcg2_protocol, NULL); if (ret != EFI_SUCCESS) { tcg2_uninit(); goto fail;