Re: [PATCH 4/4] hibernate: fix disk and module leak on successfull resume

From: Rafael J. Wysocki
Date: Tue Feb 02 2016 - 20:36:30 EST


On Monday, February 01, 2016 03:51:55 PM Roman Pen wrote:
> Do not forget to put the disk back.
>
> Signed-off-by: Roman Pen <roman.penyaev@xxxxxxxxxxxxxxxx>
> Cc: Gi-Oh Kim <gi-oh.kim@xxxxxxxxxxxxxxxx>
> Cc: "Rafael J. Wysocki" <rjw@xxxxxxxxxxxxx>
> Cc: Len Brown <len.brown@xxxxxxxxx>
> Cc: Pavel Machek <pavel@xxxxxx>
> Cc: linux-pm@xxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>

> ---
> kernel/power/hibernate.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
> index b7342a2..1f53dc2 100644
> --- a/kernel/power/hibernate.c
> +++ b/kernel/power/hibernate.c
> @@ -785,8 +785,11 @@ static int software_resume(void)
> */
> if (isdigit(resume_file[0]) && resume_wait) {
> int partno;
> - while (!get_gendisk(swsusp_resume_device, &partno))
> + struct gendisk *disk;
> +
> + while (!(disk = get_gendisk(swsusp_resume_device, &partno)))
> msleep(10);
> + put_gendisk(disk);
> }
>
> if (!swsusp_resume_device) {
>

--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.