From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (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 28B6643D4E8; Tue, 16 Jun 2026 12:10:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781611815; cv=none; b=aBvn/cSf63DkFdvPeIURHAMjDDKUrNdXTO8po3LI+msP6jfqTIewGBQCCcWotHA90BhUyeYEfV1NWqDP5QNFSXPpayi1CCh2EmzJPYIaXNDIvD5SKN+8rFZNDqChF+iLTN8gt6HgmjY8dkni/idKN46AiEcZ/xpeuXa/4lRAYD0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781611815; c=relaxed/simple; bh=ntD+GsUbmjLi/JG+uglDXeNnT9lFaB9TBOREJTGAMe0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r/Zw7vEY5EqX3lZ4Z54S8gMrEIm0czyHVFz3sF+SFBm8NdSHs3CIvKWtnvo30HYk+Fi8fIRDRvWv6l0IuGOXxyq0gnr6D7qaDCf9qp0zWfxXZJsVcT1Ye1dgHZ4oIRm9uVvhigN2ekcVsLmMISqKv3UnmHvFFiXNurOp29qyXi0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=iiv63F1E; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="iiv63F1E" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=lDcrM9t4bkxQE8cYuQzLxfGN/HLyCcLFDltTWwFcdRg=; b=iiv63F1EXtLhKIrAwNoP0bfRGl 1VNsn9kLNYtBerdihTqzvlfsFXtTdXhfxc7cKP6pqo4g6HZ0ybldi0hgR6V9U0zZtNGKIdk0vkMGw r2FmD7xKJc2EAwmsLur+78eUWrGn/16Sij3XwaP9Fs4KKUvUJKx/NyBFpeIFBPbuHn88S1GNFVScQ GasEoTl1/D8zfjstH4o6TDjxC3POUg2Q4X81klmbgLfpLCwmC0/RUFDY1z+zQBuRIUmkjOSC6ND+p iSbZg+2hKlJqBgOCkMV/5s2Cr08xYK1khsYgaL1ZZCMzDumlzTPvkEuqHgw6wK78xl+KMYRlPW9UR reo88GZg==; Received: from authenticated-user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wZScK-00DptL-1r; Tue, 16 Jun 2026 12:10:08 +0000 From: Breno Leitao Date: Tue, 16 Jun 2026 05:09:37 -0700 Subject: [PATCH v3 4/7] efi/runtime-wrappers: check EFI_RUNTIME_SERVICES before using efi_rts_work Precedence: bulk X-Mailing-List: linux-efi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260616-efi_timeout-v3-4-76dd1d26657b@debian.org> References: <20260616-efi_timeout-v3-0-76dd1d26657b@debian.org> In-Reply-To: <20260616-efi_timeout-v3-0-76dd1d26657b@debian.org> To: Ard Biesheuvel , Ilias Apalodimas , Borislav Petkov , Andy Lutomirski , Kees Cook , Tony Luck , "Guilherme G. Piccoli" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1582; i=leitao@debian.org; h=from:subject:message-id; bh=ntD+GsUbmjLi/JG+uglDXeNnT9lFaB9TBOREJTGAMe0=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqMT0H/F+b7UyQIlh0qtPOzJ3c1/LMx2FY6kNAS GywnDLXpZeJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCajE9BwAKCRA1o5Of/Hh3 bYDzEACGkAC3l4KUSgKm8O2/NqrAMaBannfgwAxk+o01oHGbqtZk1/CQ/LF+7poFXp1iGSo/nUI c/u+amJR25sbB6Xowxwef+WUHhJvRYjiN7590XoTY0ZaNlYCcC2KVCrGnfRzsVSzp4eNv2eaFoK 06sxoZ+0/nJ6VQ+sT6StPI742i9dLEHrV2RuIYt+IVbTEL/OZT4FgsQxWJYPFtB7zgTD+jFwzGf pQryB6lC4IaVmfDD6BZCN6VJMLHPj+V0AXfnEDO4Xz+tz6z0svroPd8nErxTUJ0GcmbG7uKzr1k Bg+o1t8yln81SuT48RCK5WfnUBaiZwGTF1MI5Psu4hEKw8DdhJ/7Gm3w7vAfDMlHEpvqXHb8dHa p/2zTiNsaZXu3/Wk1WHqig0g81uEBqXz8RlfMF8x8hT77QmpgQLH0z2LzKK0QISMINMHlvfNY5Y UNnQHpL6zuShO+dd/HEDKBdoZeUWZhcpADsH98QP1qZz5kq1CEUKH1oRwolxgeE/PbA7ECywm4A Zsq49wvn8fGV38iMWk8r8kecmkUtVWo5CMyn2aZPYqqnjyVhc852+5lqDHI3oyXIqLa6ZfgDTIG BICjl91vrLz2nG6Q7KgMgh6ZYOlm7Pu6Ci5ViPg4rZvAsNpVKmVWnoqVcbde9pdMEp3Fc3gUf6G VqRDO+fOQ8IblEw== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao Move the EFI_RUNTIME_SERVICES check to the top of __efi_queue_work() and return directly, so a caller that finds runtime services disabled returns without touching the shared efi_rts_work. No functional change. This prepares for bounding the wait, where a timeout will clear EFI_RUNTIME_SERVICES while the leaked worker still owns efi_rts_work; a later caller must then bail out before reinitialising it. Signed-off-by: Breno Leitao --- drivers/firmware/efi/runtime-wrappers.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c index 13857e5291b91..ae974edc0b04e 100644 --- a/drivers/firmware/efi/runtime-wrappers.c +++ b/drivers/firmware/efi/runtime-wrappers.c @@ -333,17 +333,16 @@ static void __nocfi efi_call_rts(struct work_struct *work) static efi_status_t __efi_queue_work(enum efi_rts_ids id, union efi_rts_args *args) { + if (!efi_enabled(EFI_RUNTIME_SERVICES)) { + pr_warn_once("EFI Runtime Services are disabled!\n"); + return EFI_DEVICE_ERROR; + } + efi_rts_work.efi_rts_id = id; efi_rts_work.args = args; efi_rts_work.caller = __builtin_return_address(0); efi_rts_work.status = EFI_ABORTED; - if (!efi_enabled(EFI_RUNTIME_SERVICES)) { - pr_warn_once("EFI Runtime Services are disabled!\n"); - efi_rts_work.status = EFI_DEVICE_ERROR; - goto exit; - } - init_completion(&efi_rts_work.efi_rts_comp); INIT_WORK(&efi_rts_work.work, efi_call_rts); -- 2.53.0-Meta