From 2a98e82a07909c97bc33d47e895b76dc9ca4a4fc Mon Sep 17 00:00:00 2001 From: Liu Shixin Date: Wed, 20 Apr 2022 11:53:20 +0000 Subject: [PATCH] mm/memory.c: fix clear_gigantic_page_chunk hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I5323R CVE: NA -------------------------------- Patch "mm: parallelize clear_gigantic_page" put mem_map_next() after clear_user_highpage but not modify the parameter i. So it's actually the previous page being cleared in each loop. As a result, the last page has not been cleared. Fix it by put mem_map_next() back to the original position. Fixes: ae0cd4d46ced ("mm: parallelize clear_gigantic_page") Signed-off-by: Liu Shixin Reviewed-by: Wei Li Reviewed-by: Kefeng Wang Signed-off-by: Yongqiang Liu --- mm/memory.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index d4853970a7c1..98c2872f8415 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4726,11 +4726,9 @@ static int clear_gigantic_page_chunk(unsigned long start, unsigned long end, unsigned long i; might_sleep(); - for (i = start; i < end; ++i) { + for (i = start; i < end; i++, p = mem_map_next(p, base_page, i)) { cond_resched(); clear_user_highpage(p, addr + i * PAGE_SIZE); - - p = mem_map_next(p, base_page, i); } return KTASK_RETURN_SUCCESS; -- GitLab