Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp964791lqp; Fri, 22 Mar 2024 01:00:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUoBbg+Bqe5hYXqsnBdXuR7fw4ILxNwHq3E1WUNJayr9hrSDtGRw2h1Tao2LMAlAmXUiVqI6/b6xLEmM2zMEGcz/mhJZzo+PvvV5/7xOg== X-Google-Smtp-Source: AGHT+IEIW25JayfKS2AOmQbsPNhOSRPWhsdkMm8gsUn0cFCLK5v6MBCOlIY19Kc3Xhy6cXbxOQuI X-Received: by 2002:a17:902:e887:b0:1e0:7f83:e98f with SMTP id w7-20020a170902e88700b001e07f83e98fmr1849092plg.20.1711094420824; Fri, 22 Mar 2024 01:00:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711094420; cv=pass; d=google.com; s=arc-20160816; b=y66YJiheKvJ5kCK4guspkOyHF6SJiOQdT/fO+mqXdZd5Hg7YxXQ8u7+f3o5ek7d5tL 7KLWpHD+7GHuW/ErorNCHiHjULakJcGUYckRIHwPhIg8XCuYF7VIKj3FArYQZuyIQr2O 27g8sz44lUIfvBhFMfIGyfqxSbRy7jgSiZGipZyBmbaFvI82CQib40S1Re+FM/uVJRj+ MBmqjASvRQ/JQvz0Y5TrsVfXOZkHW9MOTr94hMgQO+zAvyRepr/PnHmXFpt6FdMeDlcp rKBoATtLgQ2b0LgLESTEjWRvH4L69qfIgD2ko0C3nKTITlnFyrM0PtaSs7GoRBD4g9v4 c8Nw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Q3S6NLXd9SfZapwcM83wYHcbwCTVt19wmDCecsi+af0=; fh=baJmmyqPuL9gL+xjgmyAPwV2I3C7L5wwuKS+qjgi0bA=; b=fhU2tWOFP/aK8z6GkwdIJdRid7FKp+PFJqEUdQvdOl8wzyCATkkTtmuH/6VIu6O/7f A1K+pqPOwo0tRSLyq7gpp/cP9xQtsrwtAcGiVGva1uZk71NsmLSaxqJyHoMEx8thYK6T bsVRVZK/hqqGh7p0LqRf0vJ+bwkWorasruHkMpKWGk8NSkJRyuto27bjOB7sol8xe6TF AZWJyNRr3CONJYrX3LYaMikW2UMiKc/D9hanu6jpWTy6dwgZwFzi4wWjDwrqFCuoJdWW faYQ9yLB0KuthlCoyPi3A+SnhWfOMxNYvGt9L4wrMdgD/cuaHxe0DzcePbMGpt0EcOnH khnA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CMQquRtc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-111089-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111089-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s16-20020a170902ea1000b001e024d34330si1477270plg.438.2024.03.22.01.00.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 01:00:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111089-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CMQquRtc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-111089-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111089-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7A292286A2F for ; Fri, 22 Mar 2024 08:00:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5EA0D15AF9; Fri, 22 Mar 2024 08:00:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CMQquRtc" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7719A13FFB; Fri, 22 Mar 2024 08:00:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711094413; cv=none; b=HOMxZEDkXT/FsUoP+d5f1lMv4AYw+tq9aHfq8AsJ2vp9cOMuw88/3QN68LDBUapDTgCE6MLd610YaRFPQuHrEk9QO+s/ZaPN0vpy7XsXF7d1vXAO7/w2ivH8aDIGI5mYO+ZSBJSyjWlE2A1/VI8pXjFTyfzmkECCt1U4T33ZmSo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711094413; c=relaxed/simple; bh=pUttzwL1DYJWH3XdwaA1Y4ZDVmHRSfh3Fe1BGs2Ngt0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=f6OBQ8cMLswr6iC1BJPubsKb1P9qrFkpAOvnje1dyDhtuORU0lswShIn1CpPql/cjn6RlYo+0BrFtPCzTqWpzqaSDXmZHssnZPPVNXc1Zn8obsGMLC6omF1XtfoA0syjyjBDIzrr3TmMCIxFqNZot7LTu2r5FgUghuKFmGnFhOI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CMQquRtc; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0CEDC43394; Fri, 22 Mar 2024 08:00:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711094413; bh=pUttzwL1DYJWH3XdwaA1Y4ZDVmHRSfh3Fe1BGs2Ngt0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CMQquRtcYqhnI+2E4oD4kQOZafGCl0NVfDCpf7E5Ri1KzEeAmxQJKZk+7HalbTO34 gEvJ9fUuCbIZJ8VLFy1hDe096f4n+UoJTGSjUmaufEG7CqxGnrUmjnocyFtb603x+y CPVlsTQdtSUdAy0w3BKRwGOxl2+JaFmO8AzPm7DYllMAMQuvspP00piJYR9DpstKYw Vx9QkfqN0rcOGeesVHtA66T+4tx+99ZwB95a8SgFzxT22CPRjmBTQuJBI5iDF+EWNB XIr986UiQwePkNKzwKQ83NnXE3rORn5iWnDMYDWOHe4lHX5CiyxuAObygwBNFATl6B +mFDh2ZbhZchA== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1rnZp7-000000001O5-0HMc; Fri, 22 Mar 2024 09:00:21 +0100 Date: Fri, 22 Mar 2024 09:00:21 +0100 From: Johan Hovold To: Oleksandr Tymoshenko Cc: Ard Biesheuvel , johan+linaro@kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] efi: fix panic in kdump kernel Message-ID: References: <20240322010846.305860-1-ovt@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240322010846.305860-1-ovt@google.com> On Fri, Mar 22, 2024 at 01:08:45AM +0000, Oleksandr Tymoshenko wrote: > Check if get_next_variable() is actually valid pointer before > calling it. In kdump kernel this method is set to NULL that causes > panic during the kexec-ed kernel boot. > > Tested with QEMU and OVMF firmware. Sounds like you want a Fixes and CC stable tag here as well. > Signed-off-by: Oleksandr Tymoshenko > --- > drivers/firmware/efi/efi.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c > index 8859fb0b006d..800b85807a02 100644 > --- a/drivers/firmware/efi/efi.c > +++ b/drivers/firmware/efi/efi.c > @@ -203,6 +203,8 @@ static bool generic_ops_supported(void) > > name_size = sizeof(name); > > + if (efi.get_next_variable == NULL) > + return false; Please move this check above the name_size initialisation and make sure you have a new line before and after. I'd also suggest rewriting this as: if (!efi.get_next_variable) return false; > status = efi.get_next_variable(&name_size, &name, &guid); > if (status == EFI_UNSUPPORTED) > return false; Johan