Commit f1d47ca
mm/huge_memory: fix folio split check for anon folios in swapcache
Both uniform and non uniform split check missed the check to prevent
splitting anon folios in swapcache to non-zero order.
Splitting anon folios in swapcache to non-zero order can cause data
corruption since swapcache only support PMD order and order-0 entries.
This can happen when one use split_huge_pages under debugfs to split
anon folios in swapcache.
In-tree callers do not perform such an illegal operation. Only debugfs
interface could trigger it. I will put adding a test case on my TODO
list.
Fix the check.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 58729c0 ("mm/huge_memory: add buddy allocator like (non-uniform) folio_split()")
Signed-off-by: Zi Yan <[email protected]>
Reported-by: "David Hildenbrand (Red Hat)" <[email protected]>
Closes: https://lore.kernel.org/all/[email protected]/
Acked-by: David Hildenbrand (Red Hat) <[email protected]>
Cc: Baolin Wang <[email protected]>
Cc: Barry Song <[email protected]>
Cc: Dev Jain <[email protected]>
Cc: Lance Yang <[email protected]>
Cc: Liam Howlett <[email protected]>
Cc: Lorenzo Stoakes <[email protected]>
Cc: Nico Pache <[email protected]>
Cc: Ryan Roberts <[email protected]>
Cc: Wei Yang <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>1 parent 3470715 commit f1d47ca
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3522 | 3522 | | |
3523 | 3523 | | |
3524 | 3524 | | |
3525 | | - | |
| 3525 | + | |
| 3526 | + | |
3526 | 3527 | | |
3527 | 3528 | | |
3528 | 3529 | | |
| |||
3553 | 3554 | | |
3554 | 3555 | | |
3555 | 3556 | | |
3556 | | - | |
| 3557 | + | |
| 3558 | + | |
3557 | 3559 | | |
3558 | 3560 | | |
3559 | 3561 | | |
| |||
0 commit comments