From patchwork Mon Mar 22 12:28:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 406144 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp3535402jai; Mon, 22 Mar 2021 05:45:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzotu5lBY6i2E/p9QvwXoi4LLOtje3eQxaF1Pbb3WgkLkwxNgySZ++IMkoyun7mrF/iER+i X-Received: by 2002:aa7:da14:: with SMTP id r20mr25218144eds.181.1616417144285; Mon, 22 Mar 2021 05:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616417144; cv=none; d=google.com; s=arc-20160816; b=YpOw6IJpxCbhQCuW6TxMFrIKwUcDLlpUBjhxvRqqwu8ZFMIUQ2WqxKdk1jWe/mbp1V sLVI0XBtg86YRJPyePrPTdTPnUVn+Nc3gFso+k42tQkwcXEkd4mI4PB2bD8idd9L1o6Q pfgfwk2+n5/LXbROOoOQb5zRwr+7w4Vn9Va2ONC2R0bz9bVkgy9kZ/r7R8SqbNL/Wfgz AuT56NmCa2j/jjnn4X1Ug1XRC//cnYHwc5sTotNghPn4XITuYecKVGlVjfjtMev454xJ QpZA7L6caeD6KHa+NzdDX8/8lT4zpfdHEJQMtOEVVcQ5z3Y1xR3KQ50w74sIgqv+5dw2 2mrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YVn5CeYkW43FaLLSjkmzbbs4M5AzS7EM1Tx/vzCm74I=; b=MqzPrAoUxBe8n3gMZBI6bZkExVEI925FmDG0725I26is8dHNhYb4INLuhvvUekEqYB 7A/T7bYK6fSrQlhE0VMsmnRg7POS0sz9WSlaEHRaZojUA1TQKox1Ao+htehmOI7sD7fW /7M48FcTZ3bYJ9E0gK1NldFXj8ZY7r1/1uOAk79TSK3NAgiotim2evsSj3rUIpmKdprg 0XFQlYK5PW/SdWuFX+ZomWz6udDRQmo/j/DI3G2BwquFEQjrWqwOBmcR8hZbPEikzE01 /QDPKqaAoJzOBJU+qEtuZLsU9PzEQBnX2OH+RpPkhiJAxMtU1r/QktUN6OJ2UdFU2iM2 GW7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="YP/oBMA0"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l1si11406915ejh.597.2021.03.22.05.45.44; Mon, 22 Mar 2021 05:45:44 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="YP/oBMA0"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230230AbhCVMpS (ORCPT + 12 others); Mon, 22 Mar 2021 08:45:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:34646 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232702AbhCVMnQ (ORCPT ); Mon, 22 Mar 2021 08:43:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1DC90619A8; Mon, 22 Mar 2021 12:41:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1616416877; bh=ft9Lb4MR6Vk8OXPD4zVw5IuZdRbUn+8SmoXMMeTeq2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YP/oBMA0a7aVRaTmXbCRhWEwY+GbV68ZnL+palEFQm63TdTHnR1EFTDBHJAEFekdx e+Ivl9p6anN/jLP1smONp6WFLUNkdU5ljTO4fM9wqQn282CPaGueS8flwltc7FnhVQ pLZ08WSvehYs2KLHU4XqLbJDAYzVGqCLUNuDZBDs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shawn Guo , Ard Biesheuvel Subject: [PATCH 5.10 144/157] efivars: respect EFI_UNSUPPORTED return from firmware Date: Mon, 22 Mar 2021 13:28:21 +0100 Message-Id: <20210322121938.315527706@linuxfoundation.org> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210322121933.746237845@linuxfoundation.org> References: <20210322121933.746237845@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Shawn Guo commit 483028edacab374060d93955382b4865a9e07cba upstream. As per UEFI spec 2.8B section 8.2, EFI_UNSUPPORTED may be returned by EFI variable runtime services if no variable storage is supported by firmware. In this case, there is no point for kernel to continue efivars initialization. That said, efivar_init() should fail by returning an error code, so that efivarfs will not be mounted on /sys/firmware/efi/efivars at all. Otherwise, user space like efibootmgr will be confused by the EFIVARFS_MAGIC seen there, while EFI variable calls cannot be made successfully. Cc: # v5.10+ Signed-off-by: Shawn Guo Acked-by: Ard Biesheuvel Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/efi/vars.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/firmware/efi/vars.c +++ b/drivers/firmware/efi/vars.c @@ -485,6 +485,10 @@ int efivar_init(int (*func)(efi_char16_t } break; + case EFI_UNSUPPORTED: + err = -EOPNOTSUPP; + status = EFI_NOT_FOUND; + break; case EFI_NOT_FOUND: break; default: