lkml.org 
[lkml]   [2022]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH] mm/huge_memory: Return from zap_huge_pmd after WARN_ONCE.
    Date
    After WARN_ONCE is processed, the subsequent page judgment results
    in NULL pointer access. It is more reasonable to return from the
    function here.

    Signed-off-by: Zhou Guanghui <zhouguanghui1@huawei.com>
    ---
    mm/huge_memory.c | 5 ++++-
    1 file changed, 4 insertions(+), 1 deletion(-)

    diff --git a/mm/huge_memory.c b/mm/huge_memory.c
    index 834f288b3769..7f5ccca6792a 100644
    --- a/mm/huge_memory.c
    +++ b/mm/huge_memory.c
    @@ -1601,8 +1601,11 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
    entry = pmd_to_swp_entry(orig_pmd);
    page = pfn_swap_entry_to_page(entry);
    flush_needed = 0;
    - } else
    + } else {
    + spin_unlock(ptl);
    WARN_ONCE(1, "Non present huge pmd without pmd migration enabled!");
    + return 1;
    + }

    if (PageAnon(page)) {
    zap_deposited_table(tlb->mm, pmd);
    --
    2.17.1
    \
     
     \ /
      Last update: 2022-07-15 11:27    [W:3.149 / U:0.716 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site