Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Jan 2024 00:37:36 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 266eefe7f465 - stable/14 - vmm: Fix handling of errors from subyte()
Message-ID:  <202401020037.4020baVt085991@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=266eefe7f465cf99d592a47a1905f7ecd9f7e9bd

commit 266eefe7f465cf99d592a47a1905f7ecd9f7e9bd
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-12-26 01:43:51 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-01-02 00:30:00 +0000

    vmm: Fix handling of errors from subyte()
    
    subyte() returns -1 upon an error, not an errno value.
    
    MFC after:      1 week
    Fixes:  e17eca327633 ("vmm: Avoid embedding cpuset_t ioctl ABIs")
    
    (cherry picked from commit 6adf554abd1c848d2c9ab7ea8a7fb7dd20a0c186)
---
 sys/amd64/vmm/vmm_dev.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sys/amd64/vmm/vmm_dev.c b/sys/amd64/vmm/vmm_dev.c
index cae15d7059cb..5214cd3f1447 100644
--- a/sys/amd64/vmm/vmm_dev.c
+++ b/sys/amd64/vmm/vmm_dev.c
@@ -629,10 +629,12 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag,
 
 				p = (uint8_t *)vmrun->cpuset +
 				    sizeof(cpuset_t);
-				while (error == 0 &&
-				    p < (uint8_t *)vmrun->cpuset +
+				while (p < (uint8_t *)vmrun->cpuset +
 				    vmrun->cpusetsize) {
-					error = subyte(p++, 0);
+					if (subyte(p++, 0) != 0) {
+						error = EFAULT;
+						break;
+					}
 				}
 			}
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401020037.4020baVt085991>