Skip to contentSkip to conversation

kernel-reboot-avoid-potential-deadlocks-during-suspension.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Oct 24

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: kernel/reboot: avoid potential deadlocks during suspension
has been removed from the -mm tree. Its filename was
kernel-reboot-avoid-potential-deadlocks-during-suspension.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Edward Adam Davis <[email protected]>
Subject: kernel/reboot: avoid potential deadlocks during suspension
Date: Tue, 20 Oct 2026 09:05:59 +0800

Invoking reboot with LINUX_REBOOT_CMD_SW_SUSPEND causes kernel/reboot.c to acquire system_transition_mutex and invoke hibernate(). hibernate() calls lock_system_sleep(), which sets PF_NOFREEZE on current and attempts to acquire system_transition_mutex again, potentially hitting:

WARNING: possible recursive locking detected
--------------------------------------------
syz.3.5755/5950 is trying to acquire lock:
ffffffff8fc04760 (system_transition_mutex){+.+.}-{4:4}, at: lock_system_sleep+0x49/0x70 kernel/power/main.c:71

but task is already holding lock:
ffffffff8fc04760 (system_transition_mutex){+.+.}-{4:4}, at: __do_sys_reboot kernel/reboot.c:774 [inline] ffffffff8fc04760 (system_transition_mutex){+.+.}-{4:4}, at: __se_sys_reboot+0x223/0x460 kernel/reboot.c:738

other info that might help us debug this:

 Possible unsafe locking scenario:
       CPU0
       ----

lock(system_transition_mutex);
lock(system_transition_mutex);

*** DEADLOCK ***

May be due to missing lock nesting notation

locks held by syz.3.5755/5950: 1, last CPU#0:
#0: ffffffff8fc04760 (system_transition_mutex){+.+.}-{4:4}, at: __do_sys_reboot kernel/reboot.c:774 [inline] #0: ffffffff8fc04760 (system_transition_mutex){+.+.}-{4:4}, at: __se_sys_reboot+0x223/0x460 kernel/reboot.c:738

Call Trace:
 lock_system_sleep+0x49/0x70 kernel/power/main.c:71
 hibernate+0x162/0x680 kernel/power/hibernate.c:784
 __do_sys_reboot kernel/reboot.c:816 [inline]

Move the suspension operation outside the scope protected by lock system_transition_mutex.

---

 kernel/reboot.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/reboot.c renamed from kernel/reboot.c~kernel-reboot-avoid-potential-deadlocks-during-suspension +2 -2
@@ -804,8 +804,8 @@ SYSCALL_DEFINE4(reboot, int, magic1, int
 
 #ifdef CONFIG_HIBERNATION
 	case LINUX_REBOOT_CMD_SW_SUSPEND:
-		ret = hibernate();
-		break;
+		mutex_unlock(&system_transition_mutex);
+		return hibernate();
 #endif
 
 	default:

_

Patches currently in -mm which might be from [email protected] are