diff options
author | Vishal Moola (Oracle) <vishal.moola@gmail.com> | 2023-02-13 13:43:24 -0800 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-02-13 15:54:26 -0800 |
commit | f528260b1a7d52140dfeb58857e13fc98ac193ef (patch) | |
tree | 018eac4795456d7cc525171c586d9d8ef3472f0e /mm/memory_hotplug.c | |
parent | f67d6b26649379f8520abe6a6c7ed335310bf01e (diff) | |
download | lwn-f528260b1a7d52140dfeb58857e13fc98ac193ef.tar.gz lwn-f528260b1a7d52140dfeb58857e13fc98ac193ef.zip |
mm/khugepaged: fix invalid page access in release_pte_pages()
release_pte_pages() converts from a pfn to a folio by using pfn_folio().
If the pte is not mapped, pfn_folio() will result in undefined behavior
which ends up causing a kernel panic[1].
Only call pfn_folio() once we have validated that the pte is both valid
and mapped to fix the issue.
[1] https://lore.kernel.org/linux-mm/ff300770-afe9-908d-23ed-d23e0796e899@samsung.com/
Link: https://lkml.kernel.org/r/20230213214324.34215-1-vishal.moola@gmail.com
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Fixes: 9bdfeea46f49 ("mm/khugepaged: convert release_pte_pages() to use folios")
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Debugged-by: Alexandre Ghiti <alex@ghiti.fr>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/memory_hotplug.c')
0 files changed, 0 insertions, 0 deletions