]> git.baikalelectronics.ru Git - kernel.git/commit
userfaultfd: clear the vma->vm_userfaultfd_ctx if UFFD_EVENT_FORK fails
authorAndrea Arcangeli <aarcange@redhat.com>
Fri, 5 Jan 2018 00:18:09 +0000 (16:18 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Jan 2018 00:45:09 +0000 (16:45 -0800)
commit4eacdf8814cd0a727b23069fdd5a292da8e405cf
treee4195e9d5425397f557117077d6306eadf94e350
parent3a87a51ba0ef0fda9d7c5a05bef3d02ce1841322
userfaultfd: clear the vma->vm_userfaultfd_ctx if UFFD_EVENT_FORK fails

The previous fix in commit 3b1807356ba9 ("userfaultfd: non-cooperative:
fix fork use after free") corrected the refcounting in case of
UFFD_EVENT_FORK failure for the fork userfault paths.

That still didn't clear the vma->vm_userfaultfd_ctx of the vmas that
were set to point to the aborted new uffd ctx earlier in
dup_userfaultfd.

Link: http://lkml.kernel.org/r/20171223002505.593-2-aarcange@redhat.com
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Reviewed-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Eric Biggers <ebiggers3@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/userfaultfd.c