[PATCH 0/2] Fix a few snafus in the reboot code

From: Bradley Morgan

Date: Thu Nov 26 2026 - 16:48:07 EST


In reboot, i have found a few small snafus which i have fixed,

Patch 1 fixes a small snafu in platform_sys_off_handler,
where **IF** a caller passes NULL for cb_data, a second
SYS_OFF_PRIO_PLATFORM registration thinks that
platform_sys_off_handler is still free, hence, it reuses
the **SAME** struct, then links the same notifier_block
into two lists at once...

Patch 2 also fixes a snafu, where do_kernel_power_off()
registers a pm_power_off quickly, and then ends up
allocating with GFP_KERNEL or calling synchronize_rcu()
with interrupts off and other CPUs stopped.

I am aware these bugs are quite "edge-casey", but better
to fix them now rather then never! :)

Happy Reviewing!

Bradley Morgan (2):
reboot: fix platform sys_off handler reuse with NULL cb_data
reboot: register legacy pm_power_off once at boot

kernel/reboot.c | 83 ++++++++++++++++++++++++++++---------------------
1 file changed, 48 insertions(+), 35 deletions(-)

--
2.53.0