summaryrefslogtreecommitdiffstats
path: root/kernel/power/swap.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2006-10-17 09:09:59 +0200
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-17 17:18:44 +0200
commitc60099bfe3a5e6fa22a930627689b3769c52153f (patch)
tree477a477f6260da7c9c7871c266205d2212e17a2c /kernel/power/swap.c
parent[PATCH] acpi_processor_latency_notifier(): UP warning fix (diff)
downloadlinux-c60099bfe3a5e6fa22a930627689b3769c52153f.tar.xz
linux-c60099bfe3a5e6fa22a930627689b3769c52153f.zip
[PATCH] swsusp: fix memory leaks
My fancy new swsusp IO code had a big memory leak. It's somewhat invisible because the whole mem_map[] gets overwritten after resume, but it can cause us to get low on memory during the actual suspend process. Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/power/swap.c')
-rw-r--r--kernel/power/swap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 9b2ee5344dee..1a3b0dd2c3fc 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -425,7 +425,8 @@ static int submit(int rw, pgoff_t page_off, struct page *page,
bio_set_pages_dirty(bio);
bio_put(bio);
} else {
- get_page(page);
+ if (rw == READ)
+ get_page(page); /* These pages are freed later */
bio->bi_private = *bio_chain;
*bio_chain = bio;
submit_bio(rw | (1 << BIO_RW_SYNC), bio);