]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
futex: Fix futex lock the wrong page
authorZhangXiaoxu <zhangxiaoxu5@huawei.com>
Wed, 12 Jun 2019 01:54:25 +0000 (09:54 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Jun 2019 06:18:22 +0000 (08:18 +0200)
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 <zhangxiaoxu5@huawei.com>
Cc: stable@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/futex.c

index ec9df5ba040bab02e3a492c7c42846bdf0a68950..15d850ffbe29d265790202ce92c232cde30805ee 100644 (file)
@@ -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);