]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/security/audit/audit_session.c
xnu-2422.115.4.tar.gz
[apple/xnu.git] / bsd / security / audit / audit_session.c
index 4b63e0082ab09c5ba75214d8c55768ca0d221561..ab38cc22adf8fea78bbb327940abb9795ab12bb3 100644 (file)
@@ -1603,7 +1603,7 @@ audit_sdev_alloc(void)
 
        AUDIT_SDEV_LIST_WLOCK_ASSERT();
 
-       asdev = malloc(sizeof (*asdev), M_AUDIT_SDEV, M_NOWAIT | M_ZERO);
+       asdev = malloc(sizeof (*asdev), M_AUDIT_SDEV, M_WAITOK | M_ZERO);
        if (NULL == asdev)
                return (NULL);
 
@@ -1660,6 +1660,7 @@ audit_sdev_free(struct audit_sdev *asdev)
        audit_sdev_flush(asdev);
        cv_destroy(&asdev->asdev_cv);
        AUDIT_SDEV_SX_LOCK_DESTROY(asdev);
+       AUDIT_SDEV_UNLOCK(asdev);
        AUDIT_SDEV_LOCK_DESTROY(asdev);
 
        TAILQ_REMOVE(&audit_sdev_list, asdev, asdev_list);
@@ -1911,7 +1912,7 @@ audit_sdev_read(dev_t dev, struct uio *uio, __unused int flag)
 
                KASSERT(ase->ase_record_len > asdev->asdev_qoffset,
                    ("audit_sdev_read: record_len > qoffset (1)"));
-               toread = MIN(ase->ase_record_len - asdev->asdev_qoffset,
+               toread = MIN((int)(ase->ase_record_len - asdev->asdev_qoffset),
                    uio_resid(uio));
                AUDIT_SDEV_UNLOCK(asdev);
                error = uiomove((char *) ase->ase_record + asdev->asdev_qoffset,