The vmm(4) ioctl handler unlocks the kernel, but misses to relock it in
case of an error.
---
 sys/arch/amd64/amd64/vmm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c
index 13cf7643cb4..0ddea3ead7e 100644
--- a/sys/arch/amd64/amd64/vmm.c
+++ b/sys/arch/amd64/amd64/vmm.c
@@ -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);
@@ -709,8 +709,8 @@ 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);
 }
 
-- 
2.35.1

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to