Commit 59e469ce authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds

[PATCH] swap 1/3 swapon leak

Burton Windle <bwindle@fint.org> reported Kernel memory leak with
swapon/swapoff? LKML 31 May.  swapon uses rw_swap_page_nolock to read
swap_header page (peculiar! should probably rework that sometime),
nothing freed the buffers from the page, thus page also never freed.
parent 0e9699d3
...@@ -116,8 +116,10 @@ void rw_swap_page_nolock(int rw, swp_entry_t entry, char *buf) ...@@ -116,8 +116,10 @@ void rw_swap_page_nolock(int rw, swp_entry_t entry, char *buf)
PAGE_BUG(page); PAGE_BUG(page);
/* needs sync_page to wait I/O completation */ /* needs sync_page to wait I/O completation */
page->mapping = &swapper_space; page->mapping = &swapper_space;
if (!rw_swap_page_base(rw, entry, page)) if (rw_swap_page_base(rw, entry, page))
unlock_page(page); lock_page(page);
wait_on_page_locked(page); if (page_has_buffers(page) && !try_to_free_buffers(page))
PAGE_BUG(page);
page->mapping = NULL; page->mapping = NULL;
unlock_page(page);
} }
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