]> git.baikalelectronics.ru Git - kernel.git/commit
mm/mempolicy: Allow lookup_node() to handle fatal signal
authorPeter Xu <peterx@redhat.com>
Wed, 8 Apr 2020 01:40:09 +0000 (21:40 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 8 Apr 2020 02:34:31 +0000 (19:34 -0700)
commit7bc519a55097dfe366648acd0d251665ea5fa75d
tree3697b4a407d713c5aca73827a2d34574865508e8
parent9c4cf8a32e8aad762daeead2b5b11ccf90f685d3
mm/mempolicy: Allow lookup_node() to handle fatal signal

lookup_node() uses gup to pin the page and get node information.  It
checks against ret>=0 assuming the page will be filled in.  However it's
also possible that gup will return zero, for example, when the thread is
quickly killed with a fatal signal.  Teach lookup_node() to gracefully
return an error -EFAULT if it happens.

Meanwhile, initialize "page" to NULL to avoid potential risk of
exploiting the pointer.

Fixes: e856de95bba6 ("mm/gup: allow VM_FAULT_RETRY for multiple times")
Reported-by: syzbot+693dc11fcb53120b5559@syzkaller.appspotmail.com
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mempolicy.c