Merge tag 'pm-5.5-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fix from Rafael Wysocki: "Prevent the kernel from crashing during resume from hibernation if free pages contain leftover data from the restore kernel and init_on_free is set (Alexander Potapenko)" * tag 'pm-5.5-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: PM: hibernate: fix crashes with init_on_free=1
This commit is contained in:
@@ -1147,24 +1147,24 @@ void free_basic_memory_bitmaps(void)
|
||||
|
||||
void clear_free_pages(void)
|
||||
{
|
||||
#ifdef CONFIG_PAGE_POISONING_ZERO
|
||||
struct memory_bitmap *bm = free_pages_map;
|
||||
unsigned long pfn;
|
||||
|
||||
if (WARN_ON(!(free_pages_map)))
|
||||
return;
|
||||
|
||||
memory_bm_position_reset(bm);
|
||||
pfn = memory_bm_next_pfn(bm);
|
||||
while (pfn != BM_END_OF_MAP) {
|
||||
if (pfn_valid(pfn))
|
||||
clear_highpage(pfn_to_page(pfn));
|
||||
|
||||
if (IS_ENABLED(CONFIG_PAGE_POISONING_ZERO) || want_init_on_free()) {
|
||||
memory_bm_position_reset(bm);
|
||||
pfn = memory_bm_next_pfn(bm);
|
||||
while (pfn != BM_END_OF_MAP) {
|
||||
if (pfn_valid(pfn))
|
||||
clear_highpage(pfn_to_page(pfn));
|
||||
|
||||
pfn = memory_bm_next_pfn(bm);
|
||||
}
|
||||
memory_bm_position_reset(bm);
|
||||
pr_info("free pages cleared after restore\n");
|
||||
}
|
||||
memory_bm_position_reset(bm);
|
||||
pr_info("free pages cleared after restore\n");
|
||||
#endif /* PAGE_POISONING_ZERO */
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user