]> err.no Git - linux-2.6/commitdiff
[PATCH] swsusp: fix memory leaks
authorAndrew Morton <akpm@osdl.org>
Tue, 17 Oct 2006 07:09:59 +0000 (00:09 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 17 Oct 2006 15:18:44 +0000 (08:18 -0700)
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>
kernel/power/swap.c

index 9b2ee5344dee10b51ae4f0d1fda84b1aa99d3de4..1a3b0dd2c3fcc18b2db25fc7472560cb67edfb7e 100644 (file)
@@ -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);