Page MenuHomeFreeBSD

D31156.id92999.diff
No OneTemporary

D31156.id92999.diff

diff --git a/sys/amd64/vmm/vmm_dev.c b/sys/amd64/vmm/vmm_dev.c
--- a/sys/amd64/vmm/vmm_dev.c
+++ b/sys/amd64/vmm/vmm_dev.c
@@ -80,6 +80,7 @@
struct vmmdev_softc {
struct vm *vm; /* vm instance cookie */
struct cdev *cdev;
+ struct ucred *ucred;
SLIST_ENTRY(vmmdev_softc) link;
SLIST_HEAD(, devmem_softc) devmem;
int flags;
@@ -182,6 +183,12 @@
break;
}
+ if (sc == NULL)
+ return (NULL);
+
+ if (cr_cansee(curthread->td_ucred, sc->ucred))
+ return (NULL);
+
return (sc);
}
@@ -979,6 +986,9 @@
if (sc->vm != NULL)
vm_destroy(sc->vm);
+ if (sc->ucred != NULL)
+ crfree(sc->ucred);
+
if ((sc->flags & VSC_LINKED) != 0) {
mtx_lock(&vmmdev_mtx);
SLIST_REMOVE(&head, sc, vmmdev_softc, link);
@@ -1096,6 +1106,7 @@
goto out;
sc = malloc(sizeof(struct vmmdev_softc), M_VMMDEV, M_WAITOK | M_ZERO);
+ sc->ucred = crhold(curthread->td_ucred);
sc->vm = vm;
SLIST_INIT(&sc->devmem);
@@ -1117,8 +1128,8 @@
goto out;
}
- error = make_dev_p(MAKEDEV_CHECKNAME, &cdev, &vmmdevsw, NULL,
- UID_ROOT, GID_WHEEL, 0600, "vmm/%s", buf);
+ error = make_dev_p(MAKEDEV_CHECKNAME, &cdev, &vmmdevsw, sc->ucred,
+ UID_ROOT, GID_WHEEL, 0600, "vmm/%s", buf);
if (error != 0) {
vmmdev_destroy(sc);
goto out;

File Metadata

Mime Type
text/plain
Expires
Sun, Jul 26, 12:17 AM (10 h, 33 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35506008
Default Alt Text
D31156.id92999.diff (1 KB)

Event Timeline