From patchwork Thu Jun 15 14:39:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 693005 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d91:0:0:0:0:0 with SMTP id b17csp562316wru; Thu, 15 Jun 2023 07:40:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5/z961uGMRu/NKX/sXLHgCQ52/xOwKHiYUFRC3NnbI2yuyX3suQnpQk4WToP19vmqq6Yrt X-Received: by 2002:a05:6a20:1596:b0:114:7637:3451 with SMTP id h22-20020a056a20159600b0011476373451mr4856735pzj.37.1686840014758; Thu, 15 Jun 2023 07:40:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686840014; cv=none; d=google.com; s=arc-20160816; b=g3vIhGA0sCd6GJfx7bCGX/d2FcvmTZ2r+Gzar4aYT+HlqoNW4b7cudP+uGnTiGvcVD 3HOzuLxSVRcth7Traq705TqWD0ZfbHrpPMZ7bFs+hCH9XfgwIZl24KsTTVoK0mGD/JDl CubjHaHoU20VU0hoxkon+j9ffq5CqmKnZ0c4Kn4Q1Ab9qYI93KyWocvqBpe1fg29SuKU lKShv/pHEohAx98kfegTTqYGMlrkQpjAEO1UglAunOTphSUXNw0XcBRFqmmff56sn5EZ LvJk3WCeWLvTp+n/SIi9IlwTn20WfDWMMgmP/vsFhn6pJDpxtZUCvJj7M7vni4sNpPtr icaw== 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=L0ujacndcEbKAg1szAWK2bMgGU5ZZjU4DXRkFTiFfjk=; b=bRnINKh1Hbqp6Gb/6Y5N0FtP7fo3zRkjMEfrPry1HwRe9l6L7dOZixCibqHXhkosX9 GXcSfLa5/bTaxkzciyHtNUKAWygdcRtmLz5ttP+TZam+mfDDaTEKMa7W1T+t/lqG3LV3 r94baRe6KPoWiRhMVKEcHuFZaRp4CiOQz1EcDG013xG5jb/ea0Zzk4v2T9SaREWdtDbO OKTSnlFks+rhGxInxATCsqs8ZDCDbzG5XBVWZ/NLrrMZEBjNwL8mmTbK1G86kVfPZKEH GK32dxCiwqloceGEAj2XrwQJ8lXZ2oKUn9HKbR6ujCK7JrIWCykvCA5UaTubCvkFLODM XcbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Iic2j/7t"; 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 a18-20020a637052000000b0053f2c198398si12318661pgn.888.2023.06.15.07.40.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jun 2023 07:40:14 -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="Iic2j/7t"; 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 9EB5A8631B; Thu, 15 Jun 2023 16:39:52 +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="Iic2j/7t"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1806F862D4; Thu, 15 Jun 2023 16:39:51 +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-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (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 00573862D4 for ; Thu, 15 Jun 2023 16:39:47 +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-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3f8d5262dc8so7030075e9.0 for ; Thu, 15 Jun 2023 07:39:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686839987; x=1689431987; 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=L0ujacndcEbKAg1szAWK2bMgGU5ZZjU4DXRkFTiFfjk=; b=Iic2j/7t0SfBW8Y+umSsNDtsV/NMld6SDO+T2RsxvC4WzIrjS8MakNxl3L9V3ys24P gI21yGN939AkYaDQa9w79IqMHkNPqZF6Ip8dHt9GYT3dAzNuZeGO+iwS7O7qeZKeawJq BZKMnS3LAs/lnCJ/gSKTtxg679xgTTCkZwiLprw5NlSfte3Q2NhkKML5CjC3dC0kc3rM 1w+2vPybTr3bpo/9yTVXjoNoJTo8kFYas9N3F0NQ3FrgudZN3/AxqlhTU0UPDixd4W0l urHqlk2mS7m3ftmOwiQtgS++JOp+vlI+cSKbLMHo6izmuLWQUukhHi9jgbvlGvstHd1D XkwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686839987; x=1689431987; 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=L0ujacndcEbKAg1szAWK2bMgGU5ZZjU4DXRkFTiFfjk=; b=VIfk25P8SRi8J1Mu7qtivDWdZVB9ewfK5P0AND/p5msJPv/XdSv/hBbun7fExk1vgr GfLnK1orbq6JyIvNt1VuXDAHIOimJUVad8SN0TgGvQIp/LImOrlX+m0CvvSHL6Pm3goh bi3YcbckYfKDEGpVTu5aKIybYgPnFcNKEFYPFbWkvQVtiE4y1WWlRz2hZIGhFS6Gs+Pm wyjyI4BmmclXxMvyyCWoLmPoVJFmvKw73EZT1RSxFCgKu6x/dzpQTwaRhiIH6GkO+LGQ Ui33IID+hCUtjgO3ekzqiBERMCyuhga9wul5kESnXtMYFfOhcWpswBRUYtOSCcANOpl8 EMYQ== X-Gm-Message-State: AC+VfDy3KhGhJVyIrxtzK6DPwVq0Ox2vEZoEj/QjCizQ6jDtwLnV+jkc 23MxQwvxFINIZT84MzK5SZR1ykmSILkR/AmihyJVmw== X-Received: by 2002:a05:600c:3659:b0:3f7:aee8:c23a with SMTP id y25-20020a05600c365900b003f7aee8c23amr4357523wmq.19.1686839987439; Thu, 15 Jun 2023 07:39:47 -0700 (PDT) Received: from localhost.localdomain (ppp089210114029.access.hol.gr. [89.210.114.29]) by smtp.gmail.com with ESMTPSA id w11-20020a1cf60b000000b003f7ff6b1201sm20601273wmc.29.2023.06.15.07.39.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jun 2023 07:39:47 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt Subject: [PATCH 4/5] efi_loader: fix the return codes of UninstallProtocol Date: Thu, 15 Jun 2023 17:39:40 +0300 Message-Id: <20230615143941.416924-4-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230615143941.416924-1-ilias.apalodimas@linaro.org> References: <20230615143941.416924-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 Signed-off-by: Ilias Apalodimas Reviewed-by: Heinrich Schuchardt --- lib/efi_loader/efi_boottime.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index b148824c7ec5..d6d52d4bbac8 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(handle, NULL, NULL); if (r != EFI_SUCCESS) {