mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Andrew Morton <akpm@osdl.org>
Cc: Pavel Machek <pavel@suse.cz>, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH -mm] swsusp: fix possible lockup in user interface
Date: Sun, 22 Jan 2006 18:20:15 +0100	[thread overview]
Message-ID: <200601221820.15694.rjw@sisk.pl> (raw)

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@sisk.pl>

 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);

             reply	other threads:[~2006-01-22 17:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-22 17:20 Rafael J. Wysocki [this message]
2006-01-22 20:19 ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200601221820.15694.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®