[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7a93c298-fd78-1963-a9f6-b4a7191bf747@bytedance.com>
Date: Thu, 23 Sep 2021 23:30:01 +0800
From: Qi Zheng <zhengqi.arch@...edance.com>
To: David Hildenbrand <david@...hat.com>, naoya.horiguchi@....com,
akpm@...ux-foundation.org
Cc: 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 9/23/21 11:19 PM, David Hildenbrand wrote:
> On 23.09.21 14:26, Qi Zheng wrote:
>> The paired pte_unmap() call is missing before the
>> dev_pagemap_mapping_shift() returns. So fix it.
>>
>> Signed-off-by: Qi Zheng <zhengqi.arch@...edance.com>
>> ---
>> mm/memory-failure.c | 9 ++++++---
>> 1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
>> index e2984c123e7e..4e5419f16fd4 100644
>> --- 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;
>> }
>> /*
>>
>
> I guess this code never runs on 32bit / highmem, that's why we didn't
> notice so far.
I guess so too.
>
> Reviewed-by: David Hildenbrand <david@...hat.com>
>
Thanks,
Qi
Powered by blists - more mailing lists