summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDave Voutila <dv@cvs.openbsd.org>2023-01-13 14:15:50 +0000
committerDave Voutila <dv@cvs.openbsd.org>2023-01-13 14:15:50 +0000
commit53475f1f8488dbf5f694627d65cf715e2c01a705 (patch)
tree347ca99eef23bf9ccaa78d50c63ac4c393bcbb9a /sys
parent79211141f8a02f223beecec0f7beaa4fbee93db5 (diff)
Retake kernel lock in error paths of vmmioctl.
From Christian Ludwig.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/vmm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c
index 13cf7643cb4..969f184a1dc 100644
--- a/sys/arch/amd64/amd64/vmm.c
+++ b/sys/arch/amd64/amd64/vmm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmm.c,v 1.334 2022/12/26 23:50:20 dv Exp $ */
+/* $OpenBSD: vmm.c,v 1.335 2023/01/13 14:15:49 dv Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@@ -651,13 +651,13 @@ vmmioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
ret = rw_enter(&vmm_softc->sc_slock, RW_READ | RW_INTR);
if (ret != 0)
- return (ret);
+ goto out;
while (vmm_softc->sc_status != VMM_ACTIVE) {
ret = rwsleep_nsec(&vmm_softc->sc_status, &vmm_softc->sc_slock,
PWAIT | PCATCH, "vmmresume", INFSLP);
if (ret != 0) {
rw_exit(&vmm_softc->sc_slock);
- return (ret);
+ goto out;
}
}
refcnt_take(&vmm_softc->sc_refcnt);
@@ -708,7 +708,7 @@ vmmioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
}
refcnt_rele_wake(&vmm_softc->sc_refcnt);
-
+out:
KERNEL_LOCK();
return (ret);