Message ID | 20220209112951.3073370-1-yebin10@huawei.com |
---|---|
State | New |
Headers | show |
Series | [-next] PM:hibernate:fix miss close 'hib_resume_bdev' in load_image_and_restore | expand |
On Wed, Feb 9, 2022 at 12:13 PM Ye Bin <yebin10@huawei.com> wrote: > > 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> > --- > kernel/power/hibernate.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > 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); > -- Applied as 5.18 material, thanks!
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);
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> --- kernel/power/hibernate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)