Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

xen: take system_transition_mutex on suspend

Xen's do_suspend() calls dpm_suspend_start() without taking required
system_transition_mutex. Since 12ffc3b1513eb moved the
pm_restrict_gfp_mask() call, not taking that mutex results in a WARN.

Take the mutex in do_suspend(), and use mutex_trylock() to follow
how enter_state() does this.

Suggested-by: Jürgen Groß <jgross@suse.com>
Fixes: 12ffc3b1513eb "PM: Restrict swap use to later in the suspend sequence"
Link: https://lore.kernel.org/xen-devel/aKiBJeqsYx_4Top5@mail-itl/
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Cc: stable@vger.kernel.org # v6.16+
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20250921162853.223116-1-marmarek@invisiblethingslab.com>

authored by

Marek Marczykowski-Górecki and committed by
Juergen Gross
9d52b0b4 f770c3d8

+10 -1
+10 -1
drivers/xen/manage.c
··· 11 11 #include <linux/reboot.h> 12 12 #include <linux/sysrq.h> 13 13 #include <linux/stop_machine.h> 14 + #include <linux/suspend.h> 14 15 #include <linux/freezer.h> 15 16 #include <linux/syscore_ops.h> 16 17 #include <linux/export.h> ··· 96 95 97 96 shutting_down = SHUTDOWN_SUSPEND; 98 97 98 + if (!mutex_trylock(&system_transition_mutex)) 99 + { 100 + pr_err("%s: failed to take system_transition_mutex\n", __func__); 101 + goto out; 102 + } 103 + 99 104 err = freeze_processes(); 100 105 if (err) { 101 106 pr_err("%s: freeze processes failed %d\n", __func__, err); 102 - goto out; 107 + goto out_unlock; 103 108 } 104 109 105 110 err = freeze_kernel_threads(); ··· 162 155 163 156 out_thaw: 164 157 thaw_processes(); 158 + out_unlock: 159 + mutex_unlock(&system_transition_mutex); 165 160 out: 166 161 shutting_down = SHUTDOWN_INVALID; 167 162 }