diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2011-07-06 20:15:23 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-07-13 05:29:26 +0200 |
commit | e6c768e36cfa59595a3c72823c900aa34d7f5be8 (patch) | |
tree | 7da0b8b7270073b0b37a66123e1ec58589c145aa /include | |
parent | 7af74e7852333102fb02dd17d37aabf4d5f1220b (diff) | |
download | lwn-e6c768e36cfa59595a3c72823c900aa34d7f5be8.tar.gz lwn-e6c768e36cfa59595a3c72823c900aa34d7f5be8.zip |
PM / Hibernate: Fix free_unnecessary_pages()
commit 4d4cf23cdde2f8f9324f5684a7f349e182039529 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions