Commit a5b3c86e authored by Jack Hammer's avatar Jack Hammer Committed by James Bottomley
Browse files

[SCSI] ServeRAID: prevent seeing DADSI devices



A critical thing the ServeRAID driver MUST do is hide the physical DASDI
devices from the OS. It does this by intercepting the INQUIRY commands.

In recent 2.6.15 testing, I discovered this to be failing.

The cause was the driver assuming that the INQUIRY response data was in a
simple single buffer, when it was actually a 1 element scatter gather list.

This patch makes ips always look at the correct data when examining an
INQUIRY response.

Signed-off-by: default avatarJack Hammer <jack_hammer@adaptec.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 2254c86d
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -3499,6 +3499,7 @@ ips_map_status(ips_ha_t * ha, ips_scb_t * scb, ips_stat_t * sp)
	int device_error;
	uint32_t transfer_len;
	IPS_DCDB_TABLE_TAPE *tapeDCDB;
	IPS_SCSI_INQ_DATA inquiryData;

	METHOD_TRACE("ips_map_status", 1);

@@ -3557,14 +3558,14 @@ ips_map_status(ips_ha_t * ha, ips_scb_t * scb, ips_stat_t * sp)
				errcode = DID_OK;

				/* Restrict access to physical DASD */
				if ((scb->scsi_cmd->cmnd[0] == INQUIRY) &&
				    ((((char *) scb->scsi_cmd->
				       buffer)[0] & 0x1f) == TYPE_DISK)) {
					/* underflow -- no error               */
					/* restrict access to physical DASD    */
				if (scb->scsi_cmd->cmnd[0] == INQUIRY) {
				    ips_scmd_buf_read(scb->scsi_cmd, 
                                      &inquiryData, sizeof (inquiryData));
 				    if ((inquiryData.DeviceType & 0x1f) == TYPE_DISK) {
				        errcode = DID_TIME_OUT;
				        break;
				    }
				}
			} else
				errcode = DID_ERROR;

@@ -4135,6 +4136,7 @@ ips_chkstatus(ips_ha_t * ha, IPS_STATUS * pstatus)
	uint8_t basic_status;
	uint8_t ext_status;
	int errcode;
	IPS_SCSI_INQ_DATA inquiryData;

	METHOD_TRACE("ips_chkstatus", 1);

@@ -4255,10 +4257,10 @@ ips_chkstatus(ips_ha_t * ha, IPS_STATUS * pstatus)
			scb->scsi_cmd->result = errcode << 16;
		} else {	/* bus == 0 */
			/* restrict access to physical drives */
			if ((scb->scsi_cmd->cmnd[0] == INQUIRY) &&
			    ((((char *) scb->scsi_cmd->buffer)[0] & 0x1f) ==
			     TYPE_DISK)) {

			if (scb->scsi_cmd->cmnd[0] == INQUIRY) { 
			    ips_scmd_buf_read(scb->scsi_cmd, 
                                  &inquiryData, sizeof (inquiryData));
			    if ((inquiryData.DeviceType & 0x1f) == TYPE_DISK) 
			        scb->scsi_cmd->result = DID_TIME_OUT << 16;
			}
		}		/* else */