⬢ DragonFlyBSD Kernel Audit
DF-4237 / fix.diff
← back to finding ↓ download raw
--- sys/dev/disk/sili/sili_cam.c
+++ sys/dev/disk/sili/sili_cam.c
@@ -287,6 +287,12 @@
 	 * Issue identify, saving the result
 	 */
 	xa = sili_ata_get_xfer(ap, atx);
+	if (xa == NULL) {
+		kprintf("%s: Probe deferred, no free CCB\n",
+			ATANAME(ap, atx));
+		/* keep at_probe; retried on next XPT_SCSI_IO */
+		return (EBUSY);
+	}
 	xa->complete = sili_ata_dummy_done;
 	xa->data = &at->at_identify;
 	xa->datalen = sizeof(at->at_identify);
@@ -369,6 +375,8 @@
 		if (at->at_ncqdepth > 1) {
 			for (i = 0; i < ap->ap_sc->sc_ncmds; ++i) {
 				xa = sili_ata_get_xfer(ap, atx);
+				if (xa == NULL)
+					break;	/* pool drained by in-flight I/O */
 				if (xa->tag < at->at_ncqdepth) {
 					xa->state = ATA_S_COMPLETE;
 					sili_ata_put_xfer(xa);
@@ -1024,6 +1032,11 @@
 	 * XXX not passing NULL at for direct attach!
 	 */
 	xa = sili_ata_get_xfer(ap, atx);
+	if (xa == NULL) {
+		ccbh->status = CAM_RESRC_UNAVAIL;
+		xpt_done(ccb);
+		return;
+	}
 	rdata = (void *)csio->data_ptr;
 	rdata_len = csio->dxfer_len;
 
@@ -1418,6 +1431,11 @@
 	 * XXX not passing NULL at for direct attach!
 	 */
 	xa = sili_ata_get_xfer(ap, atx);
+	if (xa == NULL) {
+		ccbh->status = CAM_RESRC_UNAVAIL;
+		xpt_done(ccb);
+		return;
+	}
 	fis = xa->fis;
 
 	fis->flags = ATA_H2D_FLAGS_CMD | at->at_target;