Skip to content

Commit 3e5988c

Browse files
committed
xen: take system_transition_mutex on suspend
JIRA: https://issues.redhat.com/browse/RHEL-109250 commit 9d52b0b Author: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> Date: Sun Sep 21 18:28:47 2025 +0200 Xen's do_suspend() calls dpm_suspend_start() without taking required system_transition_mutex. Since 12ffc3b 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: 12ffc3b "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> Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
1 parent 9401193 commit 3e5988c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/xen/manage.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/reboot.h>
1212
#include <linux/sysrq.h>
1313
#include <linux/stop_machine.h>
14+
#include <linux/suspend.h>
1415
#include <linux/freezer.h>
1516
#include <linux/syscore_ops.h>
1617
#include <linux/export.h>
@@ -101,10 +102,16 @@ static void do_suspend(void)
101102

102103
shutting_down = SHUTDOWN_SUSPEND;
103104

105+
if (!mutex_trylock(&system_transition_mutex))
106+
{
107+
pr_err("%s: failed to take system_transition_mutex\n", __func__);
108+
goto out;
109+
}
110+
104111
err = freeze_processes();
105112
if (err) {
106113
pr_err("%s: freeze processes failed %d\n", __func__, err);
107-
goto out;
114+
goto out_unlock;
108115
}
109116

110117
err = freeze_kernel_threads();
@@ -160,6 +167,8 @@ static void do_suspend(void)
160167

161168
out_thaw:
162169
thaw_processes();
170+
out_unlock:
171+
mutex_unlock(&system_transition_mutex);
163172
out:
164173
shutting_down = SHUTDOWN_INVALID;
165174
}

0 commit comments

Comments
 (0)