From f08b8e936de962e196a0ac3cccc2fd86ce3f0f30 Mon Sep 17 00:00:00 2001 From: mpi Date: Fri, 17 Dec 2021 14:18:15 +0000 Subject: [PATCH] Do not try to unlock a NULL object. 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/uvm/uvm_fault.c b/sys/uvm/uvm_fault.c index 4cd2efea1ec..dd709eb7aad 100644 --- a/sys/uvm/uvm_fault.c +++ b/sys/uvm/uvm_fault.c @@ -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; } -- 2.20.1