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: <20210923161738.990b61933c96df78bc1bf96d@linux-foundation.org>
Date:   Thu, 23 Sep 2021 16:17:38 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Qi Zheng <zhengqi.arch@...edance.com>
Cc:     naoya.horiguchi@....com, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, songmuchun@...edance.com
Subject: Re: [PATCH] mm/memory_failure: Fix the missing pte_unmap() call

On Thu, 23 Sep 2021 20:26:42 +0800 Qi Zheng <zhengqi.arch@...edance.com> wrote:

> The paired pte_unmap() call is missing before the
> dev_pagemap_mapping_shift() returns. So fix it.
> 
> ...
>
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -306,6 +306,7 @@ static unsigned long dev_pagemap_mapping_shift(struct page *page,
>  		struct vm_area_struct *vma)
>  {
>  	unsigned long address = vma_address(page, vma);
> +	unsigned long ret = 0;
>  	pgd_t *pgd;
>  	p4d_t *p4d;
>  	pud_t *pud;
> @@ -330,10 +331,12 @@ static unsigned long dev_pagemap_mapping_shift(struct page *page,
>  		return PMD_SHIFT;
>  	pte = pte_offset_map(pmd, address);
>  	if (!pte_present(*pte))
> -		return 0;
> +		goto unmap;
>  	if (pte_devmap(*pte))
> -		return PAGE_SHIFT;
> -	return 0;
> +		ret = PAGE_SHIFT;
> +unmap:
> +	pte_unmap(pte);
> +	return ret;
>  }
>  

This is neater?

+++ a/mm/memory-failure.c
@@ -330,11 +330,8 @@ static unsigned long dev_pagemap_mapping
 	if (pmd_devmap(*pmd))
 		return PMD_SHIFT;
 	pte = pte_offset_map(pmd, address);
-	if (!pte_present(*pte))
-		goto unmap;
-	if (pte_devmap(*pte))
+	if (pte_present(*pte) && pte_devmap(*pte))
 		ret = PAGE_SHIFT;
-unmap:
 	pte_unmap(pte);
 	return ret;
 }
_

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ