Re: [PATCH] mm/page_table_check: fix accessing unmapped ptep

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 26, 2022 at 7:33 AM Miaohe Lin <linmiaohe@xxxxxxxxxx> wrote:
>
> ptep is unmapped too early, so ptep will be accessed while it's unmapped.
> Fix it by deferring pte_unmap() until page table checking is done.

I would re-word this as a cleanup. While pte_unmap() is currently
unused, it is still better to call it after we are done with *ptep in
case of future changes in other architectures.

>
> Fixes: 80110bbfbba6 ("mm/page_table_check: check entries at pmd levels")

This is more a clean-up, there is no existing bug, so no need to
backport to stable. Please remove the above.

> Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx>

With the above changes:
Acked-by: Pasha Tatashin <pasha.tatashin@xxxxxxxxxx>


> ---
>  mm/page_table_check.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/page_table_check.c b/mm/page_table_check.c
> index 3692bea2ea2c..971c3129b0e3 100644
> --- a/mm/page_table_check.c
> +++ b/mm/page_table_check.c
> @@ -234,11 +234,11 @@ void __page_table_check_pte_clear_range(struct mm_struct *mm,
>                 pte_t *ptep = pte_offset_map(&pmd, addr);
>                 unsigned long i;
>
> -               pte_unmap(ptep);
>                 for (i = 0; i < PTRS_PER_PTE; i++) {
>                         __page_table_check_pte_clear(mm, addr, *ptep);
>                         addr += PAGE_SIZE;
>                         ptep++;
>                 }
> +               pte_unmap(ptep);
>         }
>  }
> --
> 2.23.0
>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux