]> git.baikalelectronics.ru Git - kernel.git/commit
mm/gup: Mark lock taken only after a successful retake
authorPeter Xu <peterx@redhat.com>
Wed, 8 Apr 2020 01:40:10 +0000 (21:40 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 8 Apr 2020 02:34:31 +0000 (19:34 -0700)
commitf8b2de300328dcdb30fb6684c9463659ee95bd5a
tree00b778f01a2928b56a1221a1e291b06089ff8833
parenta970f48055e4202dcd39edeeb36ef0796240d0f2
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.

Fixes: d00436f5a013 ("mm/gup: allow to react to fatal signals")
Reported-by: syzbot+a8c70b7f3579fc0587dc@syzkaller.appspotmail.com
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/gup.c