Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Feb 2010 16:18:59 GMT
From:      Alexander Motin <mav@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 174097 for review
Message-ID:  <201002011618.o11GIx7N079151@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=174097

Change 174097 by mav@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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002011618.o11GIx7N079151>