Skip to content

Commit 8440f4b

Browse files
mkubecekrjwysocki
authored andcommitted
PM: Free memory bitmaps if opening /dev/snapshot fails
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
1 parent f76b168 commit 8440f4b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎kernel/power/user.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,10 @@ static int snapshot_open(struct inode *inode, struct file *filp)
113113
if (error)
114114
pm_notifier_call_chain(PM_POST_RESTORE);
115115
}
116-
if (error)
116+
if (error) {
117+
free_basic_memory_bitmaps();
117118
atomic_inc(&snapshot_device_available);
119+
}
118120
data->frozen = 0;
119121
data->ready = 0;
120122
data->platform_support = 0;

0 commit comments

Comments
 (0)