Commit c2851a9b authored by Chris Metcalf's avatar Chris Metcalf

arch/tile: fix double-free bug in homecache_free_pages()

When freeing the page with this API, the page was "put" twice.
This was only discovered bringing up an MPT fusion controller, which
actually used the API; it hadn't been invoked previously, so the bug
had gone unnoticed.
Signed-off-by: default avatarChris Metcalf <cmetcalf@tilera.com>
parent 3989efb7
...@@ -449,9 +449,12 @@ void homecache_free_pages(unsigned long addr, unsigned int order) ...@@ -449,9 +449,12 @@ void homecache_free_pages(unsigned long addr, unsigned int order)
VM_BUG_ON(!virt_addr_valid((void *)addr)); VM_BUG_ON(!virt_addr_valid((void *)addr));
page = virt_to_page((void *)addr); page = virt_to_page((void *)addr);
if (put_page_testzero(page)) { if (put_page_testzero(page)) {
int pages = (1 << order);
homecache_change_page_home(page, order, initial_page_home()); homecache_change_page_home(page, order, initial_page_home());
while (pages--) if (order == 0) {
__free_page(page++); free_hot_cold_page(page, 0);
} else {
init_page_count(page);
__free_pages(page, order);
}
} }
} }
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