Commit c60099bf authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[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: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1fec74a9
...@@ -425,7 +425,8 @@ static int submit(int rw, pgoff_t page_off, struct page *page, ...@@ -425,7 +425,8 @@ static int submit(int rw, pgoff_t page_off, struct page *page,
bio_set_pages_dirty(bio); bio_set_pages_dirty(bio);
bio_put(bio); bio_put(bio);
} else { } else {
get_page(page); if (rw == READ)
get_page(page); /* These pages are freed later */
bio->bi_private = *bio_chain; bio->bi_private = *bio_chain;
*bio_chain = bio; *bio_chain = bio;
submit_bio(rw | (1 << BIO_RW_SYNC), bio); submit_bio(rw | (1 << BIO_RW_SYNC), bio);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment