From: Andrew Morton <akpm@linux-foundation.org>
To: akpm@linux-foundation.org, david@redhat.com, linux-mm@kvack.org,
mm-commits@vger.kernel.org, naoya.horiguchi@nec.com,
songmuchun@bytedance.com, torvalds@linux-foundation.org,
zhengqi.arch@bytedance.com
Subject: [patch 15/16] mm/memory_failure: fix the missing pte_unmap() call
Date: Fri, 24 Sep 2021 15:44:03 -0700 [thread overview]
Message-ID: <20210924224403.3ZN1b5z2V%akpm@linux-foundation.org> (raw)
In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org>
From: Qi Zheng <zhengqi.arch@bytedance.com>
Subject: mm/memory_failure: fix the missing pte_unmap() call
The paired pte_unmap() call is missing before the
dev_pagemap_mapping_shift() returns. So fix it.
Davidsaid "I guess this code never runs on 32bit / highmem, that's why we
didn't notice so far".
[akpm@linux-foundation.org: cleanup]
Link: https://lkml.kernel.org/r/20210923122642.4999-1-zhengqi.arch@bytedance.com
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: Naoya Horiguchi <naoya.horiguchi@nec.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/memory-failure.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/mm/memory-failure.c~mm-memory_failure-fix-the-missing-pte_unmap-call
+++ a/mm/memory-failure.c
@@ -306,6 +306,7 @@ static unsigned long dev_pagemap_mapping
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;
@@ -329,11 +330,10 @@ static unsigned long dev_pagemap_mapping
if (pmd_devmap(*pmd))
return PMD_SHIFT;
pte = pte_offset_map(pmd, address);
- if (!pte_present(*pte))
- return 0;
- if (pte_devmap(*pte))
- return PAGE_SHIFT;
- return 0;
+ if (pte_present(*pte) && pte_devmap(*pte))
+ ret = PAGE_SHIFT;
+ pte_unmap(pte);
+ return ret;
}
/*
_
next prev parent reply other threads:[~2021-09-24 22:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-24 22:42 incoming Andrew Morton
2021-09-24 22:43 ` [patch 01/16] mm, hwpoison: add is_free_buddy_page() in HWPoisonHandlable() Andrew Morton
2021-09-24 22:43 ` [patch 02/16] kasan: fix Kconfig check of CC_HAS_WORKING_NOSANITIZE_ADDRESS Andrew Morton
2021-09-24 22:43 ` [patch 03/16] mm/damon: don't use strnlen() with known-bogus source length Andrew Morton
2021-09-24 22:43 ` [patch 04/16] xtensa: increase size of gcc stack frame check Andrew Morton
2021-09-24 22:43 ` [patch 05/16] mm/shmem.c: fix judgment error in shmem_is_huge() Andrew Morton
2021-09-24 22:43 ` [patch 06/16] ocfs2: drop acl cache for directories too Andrew Morton
2021-09-24 22:43 ` [patch 07/16] scripts/sorttable: riscv: fix undeclared identifier 'EM_RISCV' error Andrew Morton
2021-09-24 22:43 ` [patch 08/16] tools/vm/page-types: remove dependency on opt_file for idle page tracking Andrew Morton
2021-09-24 22:43 ` [patch 09/16] lib/zlib_inflate/inffast: check config in C to avoid unused function warning Andrew Morton
2021-09-24 22:43 ` [patch 10/16] mm: fs: invalidate bh_lrus for only cold path Andrew Morton
2021-09-24 22:43 ` [patch 11/16] mm/debug: sync up MR_CONTIG_RANGE and MR_LONGTERM_PIN Andrew Morton
2021-09-24 22:43 ` [patch 12/16] mm/debug: sync up latest migrate_reason to migrate_reason_names Andrew Morton
2021-09-24 22:43 ` [patch 13/16] sh: pgtable-3level: fix cast to pointer from integer of different size Andrew Morton
2021-09-24 22:44 ` [patch 14/16] kasan: always respect CONFIG_KASAN_STACK Andrew Morton
2021-09-24 22:44 ` Andrew Morton [this message]
2021-09-24 22:44 ` [patch 16/16] mm: fix uninitialized use in overcommit_policy_handler Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210924224403.3ZN1b5z2V%akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mm-commits@vger.kernel.org \
--cc=naoya.horiguchi@nec.com \
--cc=songmuchun@bytedance.com \
--cc=torvalds@linux-foundation.org \
--cc=zhengqi.arch@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).