PERFORCE change 174097 for review

Alexander Motin mav at FreeBSD.org
Mon Feb 1 16:19:00 UTC 2010


http://p4web.freebsd.org/chv.cgi?CH=174097

Change 174097 by mav at mav_mavtest on 2010/02/01 16:18:30

	Deny commands longer then device-reported ATAPI packet size.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#76 edit

Differences ...

==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#76 (text+ko) ====

@@ -1379,6 +1379,27 @@
 		(*(sim->sim_action))(sim, start_ccb);
 		break;
 	}
+	case XPT_SCSI_IO:
+	{
+		struct cam_ed *device;
+		u_int	maxlen = 0;
+
+		device = start_ccb->ccb_h.path->device;
+		if (device->protocol == PROTO_SCSI &&
+		    (device->flags & CAM_DEV_IDENTIFY_DATA_VALID)) {
+			uint16_t p =
+			    device->ident_data.config & ATA_PROTO_MASK;
+
+			maxlen = (p == ATA_PROTO_ATAPI_16) ? 16 :
+			    (p == ATA_PROTO_ATAPI_12) ? 12 : 0;
+		}
+		if (start_ccb->csio.cdb_len > maxlen) {
+			start_ccb->ccb_h.status = CAM_REQ_INVALID;
+			xpt_done(start_ccb);
+			break;
+		}
+		/* FALLTHROUGH */
+	}
 	default:
 		xpt_action_default(start_ccb);
 		break;


More information about the p4-projects mailing list