Changeset 104221 in vbox for trunk/src/VBox/Devices/Storage/VSCSI/VSCSIDevice.cpp
- Timestamp:
- Apr 8, 2024 10:18:11 AM (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VSCSI/VSCSIDevice.cpp
r103902 r104221 70 70 LogFlowFunc(("CDB: %.*Rhxs Cmd: %s\n", pVScsiReq->cbCDB, pVScsiReq->pbCDB, SCSICmdText(pVScsiReq->pbCDB[0]))); 71 71 72 if (!pVScsiReq->cbCDB) 73 { 74 *prcReq = vscsiReqSenseErrorSet(&pVScsiDevice->VScsiSense, pVScsiReq, SCSI_SENSE_ILLEGAL_REQUEST, 75 SCSI_ASC_ILLEGAL_OPCODE, 0x00); 76 return true; 77 } 78 72 79 switch (pVScsiReq->pbCDB[0]) 73 80 { … … 95 102 case SCSI_REPORT_LUNS: 96 103 { 104 if (pVScsiReq->cbCDB < 10) 105 { 106 *prcReq = vscsiReqSenseErrorSet(&pVScsiDevice->VScsiSense, pVScsiReq, SCSI_SENSE_ILLEGAL_REQUEST, 107 SCSI_ASC_ILLEGAL_OPCODE, 0x00); 108 break; 109 } 110 97 111 /* 98 112 * If allocation length is less than 16 bytes SPC compliant devices have … … 130 144 case SCSI_REQUEST_SENSE: 131 145 { 146 if (pVScsiReq->cbCDB < 5) 147 { 148 *prcReq = vscsiReqSenseErrorSet(&pVScsiDevice->VScsiSense, pVScsiReq, SCSI_SENSE_ILLEGAL_REQUEST, 149 SCSI_ASC_ILLEGAL_OPCODE, 0x00); 150 break; 151 } 152 132 153 vscsiReqSetXferDir(pVScsiReq, VSCSIXFERDIR_T2I); 133 154 vscsiReqSetXferSize(pVScsiReq, pVScsiReq->pbCDB[4]); … … 143 164 case SCSI_MAINTENANCE_IN: 144 165 { 166 if (pVScsiReq->cbCDB < 8) 167 { 168 *prcReq = vscsiLunReqSenseErrorSet(pVScsiLun, pVScsiReq, SCSI_SENSE_ILLEGAL_REQUEST, 169 SCSI_ASC_ILLEGAL_OPCODE, 0x00); 170 break; 171 } 172 145 173 if (pVScsiReq->pbCDB[1] == SCSI_MAINTENANCE_IN_REPORT_SUPP_OPC) 146 174 { … … 377 405 { 378 406 PVSCSILUNINT pVScsiLun = pVScsiDevice->papVScsiLun[pVScsiReq->iLun]; 379 rc = pVScsiLun->pVScsiLunDesc->pfnVScsiLunReqProcess(pVScsiLun, pVScsiReq); 407 PVSCSILUNDESC pVScsiLunDesc = pVScsiLun->pVScsiLunDesc; 408 uint8_t const bOpc = pVScsiReq->pbCDB[0]; 409 uint8_t const cbCdbMin = pVScsiLunDesc->pacbCdbOpc[bOpc]; 410 411 /* Fail if the opcode is not supported or the CDB is too short. */ 412 if ( cbCdbMin != VSCSI_LUN_CDB_SZ_INVALID 413 && pVScsiReq->cbCDB >= cbCdbMin) 414 rc = pVScsiLunDesc->pfnVScsiLunReqProcess(pVScsiLun, pVScsiReq); 415 else 416 { 417 /* 418 * CDB length is smaller than what the LUN expects, respond with an 419 * ILLEGAL OPCODE error. 420 */ 421 vscsiLunReqSenseErrorSet(pVScsiLun, pVScsiReq, SCSI_SENSE_ILLEGAL_REQUEST, 422 SCSI_ASC_ILLEGAL_OPCODE, 0x00); 423 424 vscsiDeviceReqComplete(pVScsiDevice, pVScsiReq, 425 SCSI_STATUS_CHECK_CONDITION, false, VINF_SUCCESS); 426 } 380 427 } 381 428 else
Note:
See TracChangeset
for help on using the changeset viewer.