From: ZhangXiaoxu Date: Wed, 12 Jun 2019 01:54:25 +0000 (+0800) Subject: futex: Fix futex lock the wrong page X-Git-Tag: v4.4.183~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd23996afa1441a2b658c33399e644a71025bdd5;p=thirdparty%2Fkernel%2Fstable.git futex: Fix futex lock the wrong page The upstram commit 65d8fc777f6d ("futex: Remove requirement for lock_page() in get_futex_key()") use variable 'page' as the page head, when merge it to stable branch, the variable `page_head` is page head. In the stable branch, the variable `page` not means the page head, when lock the page head, we should lock 'page_head', rather than 'page'. It maybe lead a hung task problem. Signed-off-by: ZhangXiaoxu Cc: stable@vger.kernel.org Cc: Thomas Gleixner Signed-off-by: Greg Kroah-Hartman --- diff --git a/kernel/futex.c b/kernel/futex.c index ec9df5ba040ba..15d850ffbe29d 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -593,8 +593,8 @@ again: * applies. If this is really a shmem page then the page lock * will prevent unexpected transitions. */ - lock_page(page); - shmem_swizzled = PageSwapCache(page) || page->mapping; + lock_page(page_head); + shmem_swizzled = PageSwapCache(page_head) || page_head->mapping; unlock_page(page_head); put_page(page_head);