Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp2210140ybn; Thu, 26 Sep 2019 08:33:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzaYKo+cOOveqvWX5n+l5tTpJ15e+0QZD1BFI1mDz5cIEgDMz/hP4jd9kgfrWZXQhnXsk57 X-Received: by 2002:a17:906:6c98:: with SMTP id s24mr3629294ejr.28.1569512014869; Thu, 26 Sep 2019 08:33:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569512014; cv=none; d=google.com; s=arc-20160816; b=IzO37UimPr0MKYB9rA+AE8kJPkomY9sWR8/Jo0e8D04CfjNdn3L/EJoyKdx7hgYfte Zq6fGF1MDvAIONzZT6k+WUPfm0Feidt9NUehuBXkCRclcP3MMzMzUCixo0CC2TW2qLfd QtImBYlSz2r5H1kev5kBmWAwfYskj5fbhnGt6euxSJmSJY65TDLOoxqyC1XNf1vBN1cR AB2nBtBRpw1TwCUF0DiChLHnLZasNPwQyP0rDBebWdTrEz9PifXOiNBtlVbv9BbicDU9 RMebb0WLd7FXjR7OYh9wQzyij/U/JrTvNZhz/+4HrxBADM4MyUqTg3K+LQyNeG6UQc0Y ierA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=bFAacK0EhR9tL7dcOk2a8c9iricrpxhApMfaN2C5N7s=; b=Yl9UbRPi5olCmVZLoMKhsw2MH/syRofGKAKE8Ej2J/5nSWs/TppnFu+xjIjgGiF1j8 eiBQJJSnKBRD8fu4os5xG5Q/SZzjku819LJO0F6qJaHJDzHS8aMMpM1aGd7PBEjsJ1K0 yhDqejxR/at6rxmTA8xuc3mTnY8VI9r528WUmH/Gfp2A/sTS+6dYphLWX/IwJs4wpnbr 5gwlNEZigOhK5eD8xBEx0yDrU7ORvlwOK9fizsbCMaqM8EwytBJsdGe0LFLnOBS+04th SFfjxNVtEzpZrOwGaN3JZi9riLhvOXahOKMmevToTSq2TElElljvvRpSA8liM7uuPUB9 xSzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XVVCfPIx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r8si1199610ejr.33.2019.09.26.08.33.10; Thu, 26 Sep 2019 08:33:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XVVCfPIx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727357AbfIZPaK (ORCPT + 99 others); Thu, 26 Sep 2019 11:30:10 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:36643 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727328AbfIZPaK (ORCPT ); Thu, 26 Sep 2019 11:30:10 -0400 Received: by mail-wm1-f66.google.com with SMTP id m18so3074929wmc.1 for ; Thu, 26 Sep 2019 08:30:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bFAacK0EhR9tL7dcOk2a8c9iricrpxhApMfaN2C5N7s=; b=XVVCfPIxAZqZ22Bx/9V4/Go1RYTasCm+AJOhH/F9Yo0dFhM1g4VfPuSLR5w/IQnJZM 4LVGFcYz570jzuJyXc909gfLBy6guLdK3itKxTSEhchbHIIzIFsqajnUcgkIsUTe6Xap 3bYUSgguZduA6Hxn+GV+VyC9gozXrAYyUVEPZ+fkkLORg6qKbTe4yNXHyvswXGCgX/qk IuCL/sg3I3wq3Zj2guPxS3iFRtodHnEkzi9RNJm0gb4OabL0cxgNmXucTkZ4UVCodZyo H+d6jPrYa2tEQWbsQsyY/oRIzsMK4q8XAPFXjDjdW4NXy6HzLVQVW0fCoZHHyMFP9lYZ LyCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bFAacK0EhR9tL7dcOk2a8c9iricrpxhApMfaN2C5N7s=; b=EDo6JREDne/rCfA6MdP7rTZgCbEHJ7xeXbLKYjTGn5XKSDoEgfRKgjFiypC+rlexUr WlOdUGBkkaUlf7gMT+QdszjP1hhesu4ZoyuT3vVkl1MEjtGt4ZV3Sr8nN0Tvsqgp0RAD K7jZs65RRKxSYg9/f10sphdTDTAN5nkQw3E8u6+PLErDkRGaAd1zbYsswZhT1Czrs4dq feBPP3dfTJerjONVRXZv6sTJTVcpfSjYhjs5quYRoW3LcLucXlc4b5vjED31sp2fTRgl r4hH9ZCfi58k74ATz24AXbYFJrBMk1xr9pMmWKsrTDdTLSLtvRbb1bMEP3lVqVW35sNS TRng== X-Gm-Message-State: APjAAAU+FZqyTHXYuoSZ89jAnnKmS+ywhXRBDNJL67edYA2IodYYQ9xB LxZ2O/g4f1Q+urrRAkd85rZymQCIgQesNNVSrHy+1g== X-Received: by 2002:a7b:c451:: with SMTP id l17mr3180348wmi.61.1569511808620; Thu, 26 Sep 2019 08:30:08 -0700 (PDT) MIME-Version: 1.0 References: <20190926141234.8271-1-ross.lagerwall@citrix.com> In-Reply-To: <20190926141234.8271-1-ross.lagerwall@citrix.com> From: Ard Biesheuvel Date: Thu, 26 Sep 2019 17:29:57 +0200 Message-ID: Subject: Re: [PATCH] x86/efi: Don't require non-blocking EFI callbacks To: Ross Lagerwall Cc: linux-efi , Darren Hart , Andy Shevchenko , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "the arch/x86 maintainers" , platform-driver-x86@vger.kernel.org, Linux Kernel Mailing List , Sai Praneeth Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 26 Sep 2019 at 16:12, Ross Lagerwall wrote: > > If a backend does not implement non-blocking EFI operations, it implies > that the normal operations are non-blocking. Is that documented anywhere? > Instead of crashing > dereferencing a NULL pointer, fallback to the normal operations since it > is safe to do so. > I agree that crashing is never the right thing to do, but I wonder whether we shouldn't just bail instead. If the provided default operation is non-blocking, the platform can populate the function pointer with a reference to the default implementation. > Fixes: 5a58bc1b1edc ("efi/x86: Use non-blocking SetVariable() for efi_delete_dummy_variable()") > Fixes: ca0e30dcaa53 ("efi: Add nonblocking option to efi_query_variable_store()") > Signed-off-by: Ross Lagerwall > --- > arch/x86/platform/efi/quirks.c | 20 ++++++++++++-------- > 1 file changed, 12 insertions(+), 8 deletions(-) > > diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c > index 3b9fd679cea9..4167f5e8f3e8 100644 > --- a/arch/x86/platform/efi/quirks.c > +++ b/arch/x86/platform/efi/quirks.c > @@ -106,11 +106,13 @@ early_param("efi_no_storage_paranoia", setup_storage_paranoia); > */ > void efi_delete_dummy_variable(void) > { > - efi.set_variable_nonblocking((efi_char16_t *)efi_dummy_name, > - &EFI_DUMMY_GUID, > - EFI_VARIABLE_NON_VOLATILE | > - EFI_VARIABLE_BOOTSERVICE_ACCESS | > - EFI_VARIABLE_RUNTIME_ACCESS, 0, NULL); > + efi_set_variable_t *set_variable = efi.set_variable_nonblocking ?: > + efi.set_variable; > + > + set_variable((efi_char16_t *)efi_dummy_name, &EFI_DUMMY_GUID, > + EFI_VARIABLE_NON_VOLATILE | > + EFI_VARIABLE_BOOTSERVICE_ACCESS | > + EFI_VARIABLE_RUNTIME_ACCESS, 0, NULL); > } > > /* > @@ -127,10 +129,12 @@ query_variable_store_nonblocking(u32 attributes, unsigned long size) > { > efi_status_t status; > u64 storage_size, remaining_size, max_size; > + efi_query_variable_info_t *query_variable_info = > + efi.query_variable_info_nonblocking ?: > + efi.query_variable_info; > > - status = efi.query_variable_info_nonblocking(attributes, &storage_size, > - &remaining_size, > - &max_size); > + status = query_variable_info(attributes, &storage_size, > + &remaining_size, &max_size); > if (status != EFI_SUCCESS) > return status; > > -- > 2.21.0 >