Skip to contentSkip to conversation

swsusp: Fix userland interface

PATCH In review Rafael J. Wysocki 2 participants 2 messages Jun 11, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 swsusp: Fix userland interface

[2.6.22 candidate, IMHO]
---
From: Rafael J. Wysocki <[email protected]>

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.

---
 kernel/power/user.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/power/user.c +3 -1
Index: linux-2.6.22-rc4/kernel/power/user.c
===================================================================
@@ -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();
#1 lore raw

Hi!

Quoted 1 line

[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.

Quoted 8 lines

---
From: Rafael J. Wysocki <[email protected]>

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.

ACK.
Pavel

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