git: 0d1ff2b04d27 - main - vmm: don't leak locks exiting vmmdev_ioctl()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 12 Jul 2023 16:17:17 UTC
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=0d1ff2b04d27c21bf7f66a0b1aaade817ed271e5 commit 0d1ff2b04d27c21bf7f66a0b1aaade817ed271e5 Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2023-07-12 16:16:40 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2023-07-12 16:16:40 +0000 vmm: don't leak locks exiting vmmdev_ioctl() At least an error from vcpu_lock_all() at line 553 would leak memseg lock. There might be other cases as well. Reviewed by: corvink, markj Differential Revision: https://reviews.freebsd.org/D40981 --- sys/amd64/vmm/vmm_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/vmm/vmm_dev.c b/sys/amd64/vmm/vmm_dev.c index 74c751d7f116..dabcd4393a3f 100644 --- a/sys/amd64/vmm/vmm_dev.c +++ b/sys/amd64/vmm/vmm_dev.c @@ -1083,6 +1083,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, break; } +done: if (vcpus_locked == SINGLE) vcpu_unlock_one(sc, vcpuid, vcpu); else if (vcpus_locked == ALL) @@ -1090,7 +1091,6 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, if (memsegs_locked) vm_unlock_memsegs(sc->vm); -done: /* * Make sure that no handler returns a kernel-internal * error value to userspace.