[Devel] [PATCH RHEL8 COMMIT] ms/mm/gup: Mark lock taken only after a successful retake
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Apr 30 19:25:36 MSK 2020
The commit is pushed to "branch-rh8-4.18.0-80.1.2.vz8.3.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-80.1.2.vz8.3.7
------>
commit b699712374130c604ee6eff2967961890726919f
Author: Peter Xu <peterx at redhat.com>
Date: Thu Apr 30 19:25:35 2020 +0300
ms/mm/gup: Mark lock taken only after a successful retake
It's definitely incorrect to mark the lock as taken even if
down_read_killable() failed.
This wass overlooked when we switched from down_read() to
down_read_killable() because down_read() won't fail while
down_read_killable() could.
mFixes: 71335f37c5e8 ("mm/gup: allow to react to fatal signals")
Reported-by: syzbot+a8c70b7f3579fc0587dc at syzkaller.appspotmail.com
Signed-off-by: Peter Xu <peterx at redhat.com>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
(cherry picked from commit c7b6a566b98524baea6a244186e665d22b633545)
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
mm/gup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/gup.c b/mm/gup.c
index 049e05960e1e..21d6c80d9405 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -947,7 +947,6 @@ static __always_inline long __get_user_pages_locked(struct task_struct *tsk,
break;
}
- *locked = 1;
ret = down_read_killable(&mm->mmap_sem);
if (ret) {
BUG_ON(ret > 0);
@@ -956,6 +955,7 @@ static __always_inline long __get_user_pages_locked(struct task_struct *tsk,
break;
}
+ *locked = 1;
ret = __get_user_pages(tsk, mm, start, 1, flags | FOLL_TRIED,
pages, NULL, locked);
if (!*locked) {
More information about the Devel
mailing list