[PATCH -mm] swsusp: fix possible lockup in user interface

From: Rafael J. Wysocki
Date: Sun Jan 22 2006 - 12:17:34 EST


Hi,

The appended patch fixes possible system lockup that may result from
calling pm_prepare_console() after processes has been frozen.

Please apply.

Greetings,
Rafael


Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx>

kernel/power/user.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)

Index: linux-2.6.16-rc1-mm2/kernel/power/user.c
===================================================================
--- linux-2.6.16-rc1-mm2.orig/kernel/power/user.c 2006-01-21 23:42:32.000000000 +0100
+++ linux-2.6.16-rc1-mm2/kernel/power/user.c 2006-01-22 17:49:07.000000000 +0100
@@ -141,9 +141,14 @@ static int snapshot_ioctl(struct inode *
break;
sys_sync();
down(&pm_sem);
+ pm_prepare_console();
disable_nonboot_cpus();
- if (freeze_processes())
+ if (freeze_processes()) {
+ thaw_processes();
+ enable_nonboot_cpus();
+ pm_restore_console();
error = -EBUSY;
+ }
up(&pm_sem);
if (!error)
data->frozen = 1;
@@ -155,6 +160,7 @@ static int snapshot_ioctl(struct inode *
down(&pm_sem);
thaw_processes();
enable_nonboot_cpus();
+ pm_restore_console();
up(&pm_sem);
data->frozen = 0;
break;
@@ -165,7 +171,6 @@ static int snapshot_ioctl(struct inode *
break;
}
down(&pm_sem);
- pm_prepare_console();
/* Free memory before shutting down devices. */
error = swsusp_shrink_memory();
if (!error) {
@@ -176,7 +181,6 @@ static int snapshot_ioctl(struct inode *
device_resume();
}
}
- pm_restore_console();
up(&pm_sem);
if (!error)
error = put_user(in_suspend, (unsigned int __user *)arg);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/