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] [day] [month] [year] [list]
Date:   Tue, 26 Jan 2021 14:20:10 +0800
From:   Miaohe Lin <linmiaohe@...wei.com>
To:     Muchun Song <songmuchun@...edance.com>
CC:     <sh_def@....com>, <linux-mm@...ck.org>,
        <linux-kernel@...r.kernel.org>, <stable@...r.kernel.org>,
        <mike.kravetz@...cle.com>, <akpm@...ux-foundation.org>
Subject: Re: [PATCH] mm: hugetlb: fix missing put_page in
 gather_surplus_pages()

Hi:
On 2021/1/26 11:10, Muchun Song wrote:
> The VM_BUG_ON_PAGE avoids the generation of any code, even if that
> expression has side-effects when !CONFIG_DEBUG_VM.
> 
> Fixes: e5dfacebe4a4 ("mm/hugetlb.c: just use put_page_testzero() instead of page_count()")
> Signed-off-by: Muchun Song <songmuchun@...edance.com>
> Cc: <stable@...r.kernel.org>
> ---
>  mm/hugetlb.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index a6bad1f686c5..082ed643020b 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -2047,13 +2047,16 @@ static int gather_surplus_pages(struct hstate *h, long delta)
>  
>  	/* Free the needed pages to the hugetlb pool */
>  	list_for_each_entry_safe(page, tmp, &surplus_list, lru) {
> +		int zeroed;
> +
>  		if ((--needed) < 0)
>  			break;
>  		/*
>  		 * This page is now managed by the hugetlb allocator and has
>  		 * no users -- drop the buddy allocator's reference.
>  		 */
> -		VM_BUG_ON_PAGE(!put_page_testzero(page), page);
> +		zeroed = put_page_testzero(page);
> +		VM_BUG_ON_PAGE(!zeroed, page);
>  		enqueue_huge_page(h, page);
>  	}
>  free:
> 

Good Catch! Thanks.

Reviewed-by: Miaohe Lin <linmiaohe@...wei.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ