Skip to content

Commit

Permalink
PM: Free memory bitmaps if opening /dev/snapshot fails
Browse files Browse the repository at this point in the history
When opening /dev/snapshot device, snapshot_open() creates memory
bitmaps which are freed in snapshot_release(). But if any of the
callbacks called by pm_notifier_call_chain() returns NOTIFY_BAD, open()
fails, snapshot_release() is never called and bitmaps are not freed.
Next attempt to open /dev/snapshot then triggers BUG_ON() check in
create_basic_memory_bitmaps(). This happens e.g. when vmwatchdog module
is active on s390x.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: stable@kernel.org
  • Loading branch information
Michal Kubecek authored and Rafael J. Wysocki committed Jun 21, 2011
1 parent f76b168 commit 8440f4b
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 @@ -113,8 +113,10 @@ static int snapshot_open(struct inode *inode, struct file *filp)
if (error)
pm_notifier_call_chain(PM_POST_RESTORE);
}
if (error)
if (error) {
free_basic_memory_bitmaps();
atomic_inc(&snapshot_device_available);
}
data->frozen = 0;
data->ready = 0;
data->platform_support = 0;
Expand Down

0 comments on commit 8440f4b

Please sign in to comment.