mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] swsusp: Fix userland interface
@ 2007-06-11 14:52 Rafael J. Wysocki
  2007-06-11 21:36 ` Pavel Machek
  0 siblings, 1 reply; 2+ messages in thread
From: Rafael J. Wysocki @ 2007-06-11 14:52 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Arkadiusz Miskiewicz, LKML, Pavel Machek

[2.6.22 candidate, IMHO]
---
From: Rafael J. Wysocki <rjw@sisk.pl>

Fix oops caused by 'cat /dev/snapshot', reported by Arkadiusz Miskiewicz, and
make it impossible to thaw tasks with the help of the swsusp userland interface
while there is a snapshot image ready to save.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 kernel/power/user.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6.22-rc4/kernel/power/user.c
===================================================================
--- linux-2.6.22-rc4.orig/kernel/power/user.c	2007-06-10 19:33:36.000000000 +0200
+++ linux-2.6.22-rc4/kernel/power/user.c	2007-06-10 19:35:59.000000000 +0200
@@ -99,6 +99,8 @@ static ssize_t snapshot_read(struct file
 	ssize_t res;
 
 	data = filp->private_data;
+	if (!data->ready)
+		return -ENODATA;
 	res = snapshot_read_next(&data->handle, count);
 	if (res > 0) {
 		if (copy_to_user(buf, data_of(data->handle), res))
@@ -163,7 +165,7 @@ static int snapshot_ioctl(struct inode *
 		break;
 
 	case SNAPSHOT_UNFREEZE:
-		if (!data->frozen)
+		if (!data->frozen || data->ready)
 			break;
 		mutex_lock(&pm_mutex);
 		thaw_processes();

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] swsusp: Fix userland interface
  2007-06-11 14:52 [PATCH] swsusp: Fix userland interface Rafael J. Wysocki
@ 2007-06-11 21:36 ` Pavel Machek
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Machek @ 2007-06-11 21:36 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Andrew Morton, Arkadiusz Miskiewicz, LKML

Hi!

> [2.6.22 candidate, IMHO]

It is trivial enough that it can go there, yes. But it is not a
regression neither it is particulary serious.

> ---
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
> Fix oops caused by 'cat /dev/snapshot', reported by Arkadiusz Miskiewicz, and
> make it impossible to thaw tasks with the help of the swsusp userland interface
> while there is a snapshot image ready to save.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

ACK. 
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-06-11 21:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-11 14:52 [PATCH] swsusp: Fix userland interface Rafael J. Wysocki
2007-06-11 21:36 ` Pavel Machek

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®