Commit a95a82e9 authored by Andrea Arcangeli's avatar Andrea Arcangeli Committed by Linus Torvalds

thp: put_page: recheck PageHead after releasing the compound_lock

After releasing the compound_lock split_huge_page can still run and release the
page before put_page_testzero runs.
Signed-off-by: default avatarAndrea Arcangeli <aarcange@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 91807063
...@@ -131,8 +131,12 @@ static void put_compound_page(struct page *page) ...@@ -131,8 +131,12 @@ static void put_compound_page(struct page *page)
atomic_dec(&page->_count); atomic_dec(&page->_count);
VM_BUG_ON(atomic_read(&page_head->_count) <= 0); VM_BUG_ON(atomic_read(&page_head->_count) <= 0);
compound_unlock_irqrestore(page_head, flags); compound_unlock_irqrestore(page_head, flags);
if (put_page_testzero(page_head)) if (put_page_testzero(page_head)) {
if (PageHead(page_head))
__put_compound_page(page_head); __put_compound_page(page_head);
else
__put_single_page(page_head);
}
} else { } else {
/* page_head is a dangling pointer */ /* page_head is a dangling pointer */
VM_BUG_ON(PageTail(page)); VM_BUG_ON(PageTail(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