This is a note to let you know that I've just added the patch titled firmware/psci: Don't register with debugfs if PSCI isn't available to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: firmware-psci-don-t-register-with-debugfs-if-psci-isn-t-available.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From cef139299fd86098c6e3dbd389d1d0b2462d7710 Mon Sep 17 00:00:00 2001 From: Marc Zyngier <maz@xxxxxxxxxx> Date: Thu, 5 Jan 2023 09:08:34 +0000 Subject: firmware/psci: Don't register with debugfs if PSCI isn't available From: Marc Zyngier <maz@xxxxxxxxxx> commit cef139299fd86098c6e3dbd389d1d0b2462d7710 upstream. Contrary to popular belief, PSCI is not a universal property of an ARM/arm64 system. There is a garden variety of systems out there that don't (or even cannot) implement it. I'm the first one deplore such a situation, but hey... On such systems, a "cat /sys/kernel/debug/psci" results in fireworks, as no invocation callback is registered. Check for the invoke_psci_fn and psci_ops.get_version pointers before registering with the debugfs subsystem, avoiding the issue altogether. Fixes: 3137f2e60098 ("firmware/psci: Add debugfs support to ease debugging") Reported-by: Hector Martin <marcan@xxxxxxxxx> Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx> Cc: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> Cc: Mark Brown <broonie@xxxxxxxxxx> Cc: Ulf Hansson <ulf.hansson@xxxxxxxxxx> Cc: Arnd Bergmann <arnd@xxxxxxxx> Cc: Mark Rutland <mark.rutland@xxxxxxx> Cc: Lorenzo Pieralisi <lpieralisi@xxxxxxxxxx> Reviewed-by: Hector Martin <marcan@xxxxxxxxx> Acked-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> Acked-by: Mark Rutland <mark.rutland@xxxxxxx> Link: https://lore.kernel.org/r/20230105090834.630238-1-maz@xxxxxxxxxx Signed-off-by: Will Deacon <will@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/firmware/psci/psci.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index e7bcfca4159f..447ee4ea5c90 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -440,6 +440,9 @@ static const struct file_operations psci_debugfs_ops = { static int __init psci_debugfs_init(void) { + if (!invoke_psci_fn || !psci_ops.get_version) + return 0; + return PTR_ERR_OR_ZERO(debugfs_create_file("psci", 0444, NULL, NULL, &psci_debugfs_ops)); } -- 2.39.0 Patches currently in stable-queue which might be from maz@xxxxxxxxxx are queue-6.1/firmware-psci-fix-mem_protect_range-function-numbers.patch queue-6.1/kvm-arm64-fix-s1ptw-handling-on-ro-memslots.patch queue-6.1/firmware-psci-don-t-register-with-debugfs-if-psci-isn-t-available.patch