Add missing kernel unlock in error path.
authoranton <anton@openbsd.org>
Tue, 7 Dec 2021 07:58:56 +0000 (07:58 +0000)
committeranton <anton@openbsd.org>
Tue, 7 Dec 2021 07:58:56 +0000 (07:58 +0000)
ok dv@

Reported-by: syzbot+c773ba1ce9b2d259d27f@syzkaller.appspotmail.com
sys/arch/amd64/amd64/vmm.c

index 485f512..d0711e8 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: vmm.c,v 1.297 2021/12/04 18:51:36 dv Exp $    */
+/*     $OpenBSD: vmm.c,v 1.298 2021/12/07 07:58:56 anton Exp $ */
 /*
  * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
  *
@@ -1004,8 +1004,10 @@ vmx_mprotect_ept(vm_map_t vm_map, paddr_t sgpa, paddr_t egpa, int prot)
                                    __func__, ret, (uint64_t)addr);
 
                        pte = vmx_pmap_find_pte_ept(pmap, addr);
-                       if (pte == NULL)
+                       if (pte == NULL) {
+                               KERNEL_UNLOCK();
                                return EFAULT;
+                       }
                }
 
                if (prot & PROT_READ)