git: 125b88f5aa91 - main - vmm: release the lock when vrtc_snapshot() fails

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 16 Nov 2026 19:00:34 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=125b88f5aa91e524acbf00411aa993677857ad2d

commit 125b88f5aa91e524acbf00411aa993677857ad2d
Author:     Wanpeng Qian <wanpengqian@gmail.com>
AuthorDate: 2026-11-16 19:00:17 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-11-16 19:00:17 +0000

    vmm: release the lock when vrtc_snapshot() fails
    
    The error path of the SNAPSHOT_*_OR_LEAVE() macros jumped past
    VRTC_UNLOCK() and returned with the vrtc lock held.
    
    Signed-off-by: Wanpeng Qian <wanpengqian@gmail.com>
    
    Reviewed by:    bnovkov, markj, jhb
    Sponsored by:   keelos.dev
    Differential Revision:  https://reviews.freebsd.org/D60232
---
 sys/amd64/vmm/io/vrtc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys/amd64/vmm/io/vrtc.c b/sys/amd64/vmm/io/vrtc.c
index a56c77b7bf73..c2f579c30c84 100644
--- a/sys/amd64/vmm/io/vrtc.c
+++ b/sys/amd64/vmm/io/vrtc.c
@@ -1056,9 +1056,8 @@ vrtc_snapshot(struct vrtc *vrtc, struct vm_snapshot_meta *meta)
 
 	vrtc_callout_reset(vrtc, vrtc_freq(vrtc));
 
-	VRTC_UNLOCK(vrtc);
-
 done:
+	VRTC_UNLOCK(vrtc);
 	return (ret);
 }
 #endif