From: Ard Biesheuvel <ardb+git@google.com>
To: linux-efi@vger.kernel.org
Cc: "Ard Biesheuvel" <ardb@kernel.org>, "Kees Cook" <kees@kernel.org>,
"Guilherme G. Piccoli" <gpiccoli@igalia.com>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Subject: [PATCH v2 3/5] efi: Statically initialize efivar_ops_nh
Date: Tue, 24 Nov 2026 18:28:13 +0100 [thread overview]
Message-ID: <20261124172811.2580784-10-ardb+git@google.com> (raw)
In-Reply-To: <20261124172811.2580784-7-ardb+git@google.com>
From: Ard Biesheuvel <ardb@kernel.org>
efisubsys_init() initializes the efivar_ops_nh notifier head at runtime,
but only after generic_ops_register() has already called
efivars_register(), which invokes blocking_notifier_call_chain() on it.
This is currently harmless: the head is zero-initialized, and
blocking_notifier_call_chain() returns early on an empty chain before
touching the rwsem. Still, it is fragile, and there is no reason to set
up the notifier head at runtime at all.
Use BLOCKING_NOTIFIER_HEAD() so it is valid from the start, and drop the
runtime initialization.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
drivers/firmware/efi/efi.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 40b423f85e06..98f6365c1a8c 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -184,7 +184,7 @@ static const struct attribute_group efi_subsys_attr_group = {
.is_visible_const = efi_attr_is_visible,
};
-struct blocking_notifier_head efivar_ops_nh;
+BLOCKING_NOTIFIER_HEAD(efivar_ops_nh);
EXPORT_SYMBOL_GPL(efivar_ops_nh);
static struct efivars generic_efivars;
@@ -485,8 +485,6 @@ static int __init efisubsys_init(void)
platform_device_register_simple("efivars", 0, NULL, 0);
}
- BLOCKING_INIT_NOTIFIER_HEAD(&efivar_ops_nh);
-
error = sysfs_create_group(efi_kobj, &efi_subsys_attr_group);
if (error) {
pr_err("efi: Sysfs attribute export failed with error %d.\n",
--
2.56.1.831.g720f3f5937-goog
next prev parent reply other threads:[~2026-11-24 17:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 17:28 [PATCH v2 0/5] efi: Fix pstore runtime en/disable Ard Biesheuvel
2026-11-24 17:28 ` [PATCH v2 1/5] efi: pstore: Make pstore_disable parameter read-only again Ard Biesheuvel
2026-11-24 17:28 ` [PATCH v2 2/5] efi: efivars: Don't dereference NULL __efivars in efivar_lock() Ard Biesheuvel
2026-11-24 17:28 ` Ard Biesheuvel [this message]
2026-11-24 17:28 ` [PATCH v2 4/5] efi: Tie 'efivars' pdev lifecycle to generic efivars Ard Biesheuvel
2026-11-24 17:28 ` [PATCH v2 5/5] efi: pstore: Convert into a platform driver for 'efivars' Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261124172811.2580784-10-ardb+git@google.com \
--to=ardb+git@google.com \
--cc=ardb@kernel.org \
--cc=gpiccoli@igalia.com \
--cc=kees@kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=u.kleine-koenig@baylibre.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox