The patch titled Subject: mm/gup: fix null pointer dereference detected by coverity has been added to the -mm tree. Its filename is mm-gup-fix-null-pointer-dereference-detected-by-coverity.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-gup-fix-null-pointer-dereference-detected-by-coverity.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-gup-fix-null-pointer-dereference-detected-by-coverity.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Miles Chen <miles.chen@xxxxxxxxxxxx> Subject: mm/gup: fix null pointer dereference detected by coverity In fixup_user_fault(), it is possible that unlocked is NULL, so we should test unlocked before using it. For example, in arch/arc/kernel/process.c, NULL is passed to fixup_user_fault(). SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new) { ... ret = fixup_user_fault(current, current->mm, (unsigned long) uaddr, FAULT_FLAG_WRITE, NULL); ... } Link: http://lkml.kernel.org/r/20200407095107.1988-1-miles.chen@xxxxxxxxxxxx Fixes: 4a9e1cda2748 ("mm: bring in additional flag for fixup_user_fault to signal unlock") Signed-off-by: Miles Chen <miles.chen@xxxxxxxxxxxx> Reviewed-by: Ira Weiny <ira.weiny@xxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/gup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/mm/gup.c~mm-gup-fix-null-pointer-dereference-detected-by-coverity +++ a/mm/gup.c @@ -1231,7 +1231,8 @@ retry: if (ret & VM_FAULT_RETRY) { down_read(&mm->mmap_sem); if (!(fault_flags & FAULT_FLAG_TRIED)) { - *unlocked = true; + if (unlocked) + *unlocked = true; fault_flags |= FAULT_FLAG_TRIED; goto retry; } _ Patches currently in -mm which might be from miles.chen@xxxxxxxxxxxx are mm-gup-fix-null-pointer-dereference-detected-by-coverity.patch