From patchwork Tue Jun 20 06:19:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 694429 Delivered-To: patch@linaro.org Received: by 2002:adf:e885:0:0:0:0:0 with SMTP id d5csp143702wrm; Mon, 19 Jun 2023 23:20:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Zg15qfzn0rDczqzlUF0oV1ImiHXktjkiUaMDpC2yaZX6X0lL8nowqKYNa5HB3BTPLHNWr X-Received: by 2002:a92:d590:0:b0:33c:5182:6d04 with SMTP id a16-20020a92d590000000b0033c51826d04mr10776192iln.7.1687242009623; Mon, 19 Jun 2023 23:20:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687242009; cv=none; d=google.com; s=arc-20160816; b=TjaQw3FFuTntn1JHYuWuvnfzxt9I6PTRGtmnTsuyuMzgdLTgOquFpMxqJdKxRMClkr 92oKzi7vKi1bKpEBuaZ0vJqpgxFmgk1Zh0RfyJTPVReY1sBK7e4wC1EQS+albrb8wt0a cAResiNlCI1goH7XL79bfGpAJo8FhrOd7aOIo7kkVbzQn6ZYxFBU2DLByoH3RAspDL/F 2wXjphHcbf8U5glI6nVy6wHsL7LugAUnYN+YHWQAobiW85fjOQ1tl8rBiSdRwF10QDuu dBveEPge0PeML+1y+siE2g+Abi01peflEkmRKUOMwMXLMFuirdEuisrQG0am36SaFoWB NeEA== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rRIlS0WOrDFNDf/dI9FgWLb0cebVBlSg4oZ92pTlM/o=; b=KARLsbalbirBpGBViYyILJAzsHbyqr6YombTskde7jEEzpVA7IbfgAC75x4YkYUFYW uVkZNWeQZEATbTz9ZWCd4CnbFuwdU8UJGVpVKenfbJDsqgCk9TSGmoMtM55U0qud8Ssn dTXxAPmQt4IG6xk8zr3w+nVpLuYT/CdXctcGFW+2ws6W840Bf+xmuYDWcIs2MDeeRgvG ItLMYN43jor6bhsn8FosqxmoAAdCWsmDZCobih3sLMXgyBJFefaEivjKxehMntdWTuDl LhBLZ5F7I6pVi7Mv4/zOouSA4T8mKal5jelcsh0/mHJqbSy33jFVk6kJxxuee+Y+URpK /dzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M7CDMj4A; 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 w2-20020a92d2c2000000b00342845766e0si528236ilg.37.2023.06.19.23.20.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 23:20:09 -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=M7CDMj4A; 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 3A5E486335; Tue, 20 Jun 2023 08:19:49 +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="M7CDMj4A"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3681E86308; Tue, 20 Jun 2023 08:19:43 +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-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) (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 5E51286334 for ; Tue, 20 Jun 2023 08:19:39 +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-ej1-x62f.google.com with SMTP id a640c23a62f3a-988e6fc41ccso156877266b.3 for ; Mon, 19 Jun 2023 23:19:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687241979; x=1689833979; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rRIlS0WOrDFNDf/dI9FgWLb0cebVBlSg4oZ92pTlM/o=; b=M7CDMj4AFAMFHeHJ50RSm/sCPZDWSaUxm9hx9ZOwtn2h1ky5ze9J+ih3qvuh4tDCo+ dYFb24aZl5IBr0ijtyZKf8fGgEv+kbdwEyO0ruPVAGQrw8f16O4XqWqAEFrbQ5AFi8C/ yKtQgfCuA4zvUBB2Ed43gSshgcb0QrSSWa+kCCxJS8WSJa9ku/4B1kxC9srX2DcZUX/I CDrM9ZGDz0fND69wDQBxt+jlATlhc/ARFyooSuQpKXwscitvlA0bJLCs5dIYkHYnMb9w VMMqbgt3s67+uoH2gTdCkE7RT5mo/iuOqrtLKiDRcRah8hRp6u5Kj3ypUVJ0Rwhz0kPq VX2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687241979; x=1689833979; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rRIlS0WOrDFNDf/dI9FgWLb0cebVBlSg4oZ92pTlM/o=; b=NdzJiQCr/zORwwcBJz/FbveD2+MwagwtALcahUJLxegnSlWwFBo93Kzyab7nsLO4bs xGapkDQPrMVkBSUCwF4bTLFH6ukep1NtUNc8UdmlQpLAPBbcupifzDoMDCwiC1VcyZuL qoI31OZiER6Ba9MJPQVofjMfJNBwlk+7DCPATVLyYpy2VkEqYCqbVGvkpHlYp7Mx2uQg L3eDypM2NVv1c41rj0qRDtMxZdwgiHeOUdlEAvEgzPEWA2Je/qrEZdTVZer9ahGCdLXx kZNSfsDbruqIk98kvZ81K50zGV4kmm6O6EPVGSqmTVUemHdD8pjO3XELNz+H52zGm9qh 7ozA== X-Gm-Message-State: AC+VfDxC7cXGqbaa7rIWVA79asB1ltqEITOJedOK1C8prpSu0fSf5UyY 6e0X0Mu/rANTIBE4iSurkN4Wy50T6ePAIwUpCclEOA== X-Received: by 2002:a17:906:f84d:b0:965:6a32:7de6 with SMTP id ks13-20020a170906f84d00b009656a327de6mr7398012ejb.30.1687241978895; Mon, 19 Jun 2023 23:19:38 -0700 (PDT) Received: from localhost.localdomain (ppp089210114029.access.hol.gr. [89.210.114.29]) by smtp.gmail.com with ESMTPSA id a22-20020a1709063a5600b00988e699d07fsm729988ejf.112.2023.06.19.23.19.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 23:19:38 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt Subject: [PATCH 3/4 v2] efi_loader: fix the return codes of UninstallProtocol Date: Tue, 20 Jun 2023 09:19:30 +0300 Message-Id: <20230620061932.113292-4-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230620061932.113292-1-ilias.apalodimas@linaro.org> References: <20230620061932.113292-1-ilias.apalodimas@linaro.org> 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 Up to now we did not check the return value of DisconnectController. A previous patch is fixing that taking into account what happened during the controller disconnect. But that check takes place before our code is trying to figure out if the interface exists to begin with. In case a driver is not allowed to unbind -- e.g returning EFI_DEVICE_ERROR, we will end up returning that error instead of EFI_NOT_FOUND. Add an extra check on the top of the function to make sure the protocol interface exists before trying to disconnect any drivers Reviewed-by: Heinrich Schuchardt Signed-off-by: Ilias Apalodimas --- lib/efi_loader/efi_boottime.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.40.1 diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index bfcd913dfad9..d75a3336e3f1 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1373,6 +1373,8 @@ static efi_status_t efi_uninstall_protocol r = efi_search_protocol(handle, protocol, &handler); if (r != EFI_SUCCESS) goto out; + if (handler->protocol_interface != protocol_interface) + return EFI_NOT_FOUND; /* Disconnect controllers */ r = efi_disconnect_all_drivers(efiobj, protocol, NULL); if (r != EFI_SUCCESS) {