Commit a995199
mm: fix apply_to_existing_page_range()
In the case of apply_to_existing_page_range(), apply_to_pte_range() is
reached with 'create' set to false. When !create, the loop over the PTE
page table is broken.
apply_to_pte_range() will only move to the next PTE entry if 'create' is
true or if the current entry is not pte_none().
This means that the user of apply_to_existing_page_range() will not have
'fn' called for any entries after the first pte_none() in the PTE page
table.
Fix the loop logic in apply_to_pte_range().
There are no known runtime issues from this, but the fix is trivial enough
for stable@ even without a known buggy user.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Kirill A. Shutemov <[email protected]>
Fixes: be1db47 ("mm/memory.c: add apply_to_existing_page_range() helper")
Cc: Daniel Axtens <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>1 parent 9286857 commit a995199
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2938 | 2938 | | |
2939 | 2939 | | |
2940 | 2940 | | |
2941 | | - | |
| 2941 | + | |
2942 | 2942 | | |
2943 | 2943 | | |
2944 | 2944 | | |
2945 | | - | |
| 2945 | + | |
2946 | 2946 | | |
2947 | 2947 | | |
2948 | 2948 | | |
| |||
0 commit comments