Do not try to unlock a NULL object.
authormpi <mpi@openbsd.org>
Fri, 17 Dec 2021 14:18:15 +0000 (14:18 +0000)
committermpi <mpi@openbsd.org>
Fri, 17 Dec 2021 14:18:15 +0000 (14:18 +0000)
Fix a NULL dereference introduced in previous, reported by anton@ and
Benjamin Baier.

Reported-by: syzbot+c172bd335801b67e515b@syzkaller.appspotmail.com
sys/uvm/uvm_fault.c

index 4cd2efe..dd709eb 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvm_fault.c,v 1.122 2021/12/15 12:53:53 mpi Exp $     */
+/*     $OpenBSD: uvm_fault.c,v 1.123 2021/12/17 14:18:15 mpi Exp $     */
 /*     $NetBSD: uvm_fault.c,v 1.51 2000/08/06 00:22:53 thorpej Exp $   */
 
 /*
@@ -1322,7 +1322,8 @@ uvm_fault_lower(struct uvm_faultinfo *ufi, struct uvm_faultctx *flt,
                }
 
                if (locked == FALSE) {
-                       rw_exit(uobj->vmobjlock);
+                       if (uobjpage != PGO_DONTCARE)
+                               rw_exit(uobj->vmobjlock);
                        return ERESTART;
                }