Commit d5c7069e authored by ZhangXiaoxu's avatar ZhangXiaoxu Committed by Stefan Bader

futex: Fix futex lock the wrong page

BugLink: https://bugs.launchpad.net/bugs/1836666

The upstram commit 65d8fc77 ("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: default avatarZhangXiaoxu <zhangxiaoxu5@huawei.com>
Cc: stable@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent ed802168
...@@ -593,8 +593,8 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw) ...@@ -593,8 +593,8 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw)
* applies. If this is really a shmem page then the page lock * applies. If this is really a shmem page then the page lock
* will prevent unexpected transitions. * will prevent unexpected transitions.
*/ */
lock_page(page); lock_page(page_head);
shmem_swizzled = PageSwapCache(page) || page->mapping; shmem_swizzled = PageSwapCache(page_head) || page_head->mapping;
unlock_page(page_head); unlock_page(page_head);
put_page(page_head); put_page(page_head);
......
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