⬢ DragonFlyBSD Kernel Audit
DF-5499 / fix.diff
← back to finding ↓ download raw
--- a/sys/bus/cam/scsi/scsi_pass.c
+++ b/sys/bus/cam/scsi/scsi_pass.c
@@ -451,6 +451,9 @@ passioctl(struct dev_ioctl_args *ap)
 	if (periph == NULL)
 		return(ENXIO);
 
+	if (cam_periph_acquire(periph) != CAM_REQ_CMP)
+		return(ENXIO);
+
 	cam_periph_lock(periph);
 
 	error = 0;
@@ -522,7 +525,9 @@ passioctl(struct dev_ioctl_args *ap)
 	}
 
 	cam_periph_unlock(periph);
+	cam_periph_release(periph);
 	return(error);
 }