summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorYe Bin <yebin10@huawei.com>2022-02-09 19:29:51 +0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2022-02-16 19:47:52 +0100
commit3f51aa9e296fe4af785d5761bb12556fb2494761 (patch)
tree98f99d005f509e314be6d1bcc615824c4d64ef64 /kernel
parent754e0b0e35608ed5206d6a67a791563c631cec07 (diff)
downloadlinux-stable-3f51aa9e296fe4af785d5761bb12556fb2494761.tar.gz
linux-stable-3f51aa9e296fe4af785d5761bb12556fb2494761.tar.bz2
linux-stable-3f51aa9e296fe4af785d5761bb12556fb2494761.zip
PM: hibernate: fix load_image_and_restore() error path
As 'swsusp_check' open 'hib_resume_bdev', if call 'create_basic_memory_bitmaps' failed, we need to close 'hib_resume_bdev' in 'load_image_and_restore' function. Signed-off-by: Ye Bin <yebin10@huawei.com> [ rjw: Subject ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/hibernate.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index e6af502c2fd7..49d1df0218cb 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -689,8 +689,10 @@ static int load_image_and_restore(void)
lock_device_hotplug();
error = create_basic_memory_bitmaps();
- if (error)
+ if (error) {
+ swsusp_close(FMODE_READ | FMODE_EXCL);
goto Unlock;
+ }
error = swsusp_read(&flags);
swsusp_close(FMODE_READ | FMODE_EXCL);