lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0g1PyhxaD+mk0ccHStpO0YZhRXLdE=X5zKCx0xAGpL5QQ@mail.gmail.com>
Date:   Thu, 21 Sep 2023 20:26:38 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Brian Geffon <bgeffon@...gle.com>
Cc:     "Rafael J . Wysocki" <rafael@...nel.org>,
        Pavel Machek <pavel@....cz>, Len Brown <len.brown@...el.com>,
        linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Matthias Kaehlcke <mka@...omium.org>, stable@...r.kernel.org
Subject: Re: [PATCH] PM: hibernate: use __get_safe_page() rather than touching
 the list.

On Thu, Sep 21, 2023 at 7:01 PM Brian Geffon <bgeffon@...gle.com> wrote:
>
> We found at least one situation where the safe pages list was empty and
> get_buffer() would gladly try to use a NULL pointer.
>
> Signed-off-by: Brian Geffon <bgeffon@...gle.com>
> Fixes: 8357376 ("swsusp: Improve handling of highmem")
> Cc: stable@...r.kernel.org
>
> Change-Id: Ibb43a9b4ac5ff2d7e3021fdacc08e116650231e9
> ---
>  kernel/power/snapshot.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
> index 362e6bae5891..2dcb33248518 100644
> --- a/kernel/power/snapshot.c
> +++ b/kernel/power/snapshot.c
> @@ -2544,8 +2544,9 @@ static void *get_highmem_page_buffer(struct page *page,
>                 pbe->copy_page = pfn_to_page(pfn);
>         } else {
>                 /* Copy of the page will be stored in normal memory */
> -               kaddr = safe_pages_list;
> -               safe_pages_list = safe_pages_list->next;
> +               kaddr = __get_safe_page(ca->gfp_mask);
> +               if (!kaddr)
> +                       return ERR_PTR(-ENOMEM);
>                 pbe->copy_page = virt_to_page(kaddr);
>         }
>         pbe->next = highmem_pblist;
> @@ -2747,8 +2748,9 @@ static void *get_buffer(struct memory_bitmap *bm, struct chain_allocator *ca)
>                 return ERR_PTR(-ENOMEM);
>         }
>         pbe->orig_address = page_address(page);
> -       pbe->address = safe_pages_list;
> -       safe_pages_list = safe_pages_list->next;
> +       pbe->address = __get_safe_page(ca->gfp_mask);
> +       if (!pbe->address)
> +               return ERR_PTR(-ENOMEM);
>         pbe->next = restore_pblist;
>         restore_pblist = pbe;
>         return pbe->address;
> --

Applied as 6.7 material, thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ