Skip to content

Commit

Permalink
swsusp: Fix userland interface
Browse files Browse the repository at this point in the history
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>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Rafael J. Wysocki authored and Linus Torvalds committed Jun 16, 2007
1 parent b1d93de commit 2f41ddd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kernel/power/user.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ static ssize_t snapshot_read(struct file *filp, char __user *buf,
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))
Expand Down Expand Up @@ -245,7 +247,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
break;

case SNAPSHOT_UNFREEZE:
if (!data->frozen)
if (!data->frozen || data->ready)
break;
mutex_lock(&pm_mutex);
thaw_processes();
Expand Down

0 comments on commit 2f41ddd

Please sign in to comment.