Commit 3a83c8c8 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents a572582b 18451f9f
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -1147,13 +1147,13 @@ 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;

	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) {
@@ -1164,7 +1164,7 @@ void clear_free_pages(void)
		}
		memory_bm_position_reset(bm);
		pr_info("free pages cleared after restore\n");
#endif /* PAGE_POISONING_ZERO */
	}
}

/**