WSL2-Linux-Kernel/kernel/power
Rafael J. Wysocki 4d4cf23cdd PM / Hibernate: Fix free_unnecessary_pages()
There is a bug in free_unnecessary_pages() that causes it to
attempt to free too many pages in some cases, which triggers the
BUG_ON() in memory_bm_clear_bit() for copy_bm.  Namely, if
count_data_pages() is initially greater than alloc_normal, we get
to_free_normal equal to 0 and "save" greater from 0.  In that case,
if the sum of "save" and count_highmem_pages() is greater than
alloc_highmem, we subtract a positive number from to_free_normal.
Hence, since to_free_normal was 0 before the subtraction and is
an unsigned int, the result is converted to a huge positive number
that is used as the number of pages to free.

Fix this bug by checking if to_free_normal is actually greater
than or equal to the number we're going to subtract from it.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Reported-and-tested-by: Matthew Garrett <mjg@redhat.com>
Cc: stable@kernel.org
2011-07-06 20:15:23 +02:00
..
Kconfig PM: Remove CONFIG_PM_VERBOSE 2011-05-17 23:25:10 +02:00
Makefile kernel: change to new flag variable 2011-03-17 14:02:54 +01:00
block_io.c block: kill off REQ_UNPLUG 2011-03-10 08:52:27 +01:00
console.c vt: introduce and use vt_kmsg_redirect() function 2009-12-15 08:53:28 -08:00
hibernate.c PM / Hibernate: Update kerneldoc comments in hibernate.c 2011-05-24 23:36:06 +02:00
main.c PM / Hibernate: Add sysfs knob to control size of memory for drivers 2011-05-17 23:19:19 +02:00
power.h PM / Hibernate: Add sysfs knob to control size of memory for drivers 2011-05-17 23:19:19 +02:00
poweroff.c Input: sysrq - drop tty argument from sysrq ops handlers 2010-08-19 22:07:06 -07:00
process.c workqueue, freezer: unify spelling of 'freeze' + 'able' to 'freezable' 2011-02-16 17:48:59 +01:00
snapshot.c PM / Hibernate: Fix free_unnecessary_pages() 2011-07-06 20:15:23 +02:00
suspend.c Merge branch 'syscore' into for-linus 2011-05-17 23:23:40 +02:00
suspend_test.c PM: Make warning in suspend_test_finish() less likely to happen 2009-10-22 08:23:45 +09:00
swap.c Merge branch 'for-2.6.38/core' of git://git.kernel.dk/linux-2.6-block 2011-01-13 10:45:01 -08:00
user.c PM: Free memory bitmaps if opening /dev/snapshot fails 2011-06-21 23:20:06 +02:00