VirtualBox

Changeset 46597 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jun 17, 2013 3:43:04 PM (11 years ago)
Author:
vboxsync
Message:

VSCSI: Fail unsupported MODE SENSE requests.

Location:
trunk/src/VBox/Devices/Storage/VSCSI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/VSCSI/VSCSILunMmc.cpp

    r44528 r46597  
    262262            uint8_t aReply[24];
    263263            uint8_t *pu8ReplyPos;
     264            bool    fValid = false;
    264265
    265266            memset(aReply, 0, sizeof(aReply));
     
    277278                *pu8ReplyPos++ = 0x12; /* Size of the page. */
    278279                *pu8ReplyPos++ = 0x4;  /* Write cache enabled. */
    279             }
    280 
    281             RTSgBufCopyFromBuf(&pVScsiReq->SgBuf, aReply, sizeof(aReply));
    282             rcReq = vscsiLunReqSenseOkSet(pVScsiLun, pVScsiReq);
     280                fValid = true;
     281            } else if (uModePage == 0) {
     282                fValid = true;
     283            }
     284
     285            /* Querying unknown pages must fail. */
     286            if (fValid) {
     287                RTSgBufCopyFromBuf(&pVScsiReq->SgBuf, aReply, sizeof(aReply));
     288                rcReq = vscsiLunReqSenseOkSet(pVScsiLun, pVScsiReq);
     289            } else {
     290                rcReq = vscsiLunReqSenseErrorSet(pVScsiLun, pVScsiReq, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET, 0x00);
     291            }
    283292            break;
    284293        }
  • trunk/src/VBox/Devices/Storage/VSCSI/VSCSILunSbc.cpp

    r46400 r46597  
    256256            uint8_t aReply[24];
    257257            uint8_t *pu8ReplyPos;
     258            bool    fValid = false;
    258259
    259260            memset(aReply, 0, sizeof(aReply));
     
    274275                *pu8ReplyPos++ = 0x12; /* Size of the page. */
    275276                *pu8ReplyPos++ = 0x4;  /* Write cache enabled. */
    276             }
    277 
    278             RTSgBufCopyFromBuf(&pVScsiReq->SgBuf, aReply, sizeof(aReply));
    279             rcReq = vscsiLunReqSenseOkSet(pVScsiLun, pVScsiReq);
     277                fValid = true;
     278            } else if (uModePage == 0) {
     279                fValid = 0;
     280            }
     281
     282            /* Querying unknown pages must fail. */
     283            if (fValid) {
     284                RTSgBufCopyFromBuf(&pVScsiReq->SgBuf, aReply, sizeof(aReply));
     285                rcReq = vscsiLunReqSenseOkSet(pVScsiLun, pVScsiReq);
     286            } else {
     287                rcReq = vscsiLunReqSenseErrorSet(pVScsiLun, pVScsiReq, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET, 0x00);
     288            }
    280289            break;
    281290        }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette