kernel/futex.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/kernel/futex.c b/kernel/futex.c index ea87f4d2f455..8d2ee2f66418 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -310,21 +310,25 @@ again: if (page != page_head) { get_page(page_head); put_page(page); + /* Avoid "unused label" for non-THP config */ + if (0) + goto again; } #endif lock_page(page_head); + + /* + * If the page doesn't have a mapping associated with it, + * this is either an anonymous page that was accessed RO + * (so no COW etc) and we would just return EFAULT anyway, + * or some special case page (ZERO_PAGE, gate area, special + * mapping..). + */ if (!page_head->mapping) { unlock_page(page_head); put_page(page_head); - /* - * ZERO_PAGE pages don't have a mapping. Avoid a busy loop - * trying to find one. RW mapping would have COW'd (and thus - * have a mapping) so this page is RO and won't ever change. - */ - if ((page_head == ZERO_PAGE(address))) - return -EFAULT; - goto again; + return -EFAULT; } /*