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.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -99,6 +99,8 @@ static ssize_t snapshot_read(struct file *filp, char __user *buf, · 98 unmodified lines | ||
| 99 | 99 | ssize_t res; |
| 100 | 100 | |
| 101 | 101 | data = filp->private_data; |
| 102 | + if (!data->ready) | |
| 103 | + return -ENODATA; | |
| 102 | 104 | res = snapshot_read_next(&data->handle, count); |
| 103 | 105 | if (res > 0) { |
| 104 | 106 | if (copy_to_user(buf, data_of(data->handle), res)) |
| @@ -245,7 +247,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp, · 140 unmodified lines | ||
| 245 | 247 | break; |
| 246 | 248 | |
| 247 | 249 | case SNAPSHOT_UNFREEZE: |
| 248 | − if (!data->frozen) | |
| 250 | + if (!data->frozen || data->ready) | |
| 249 | 251 | break; |
| 250 | 252 | mutex_lock(&pm_mutex); |
| 251 | 253 | thaw_processes(); |