VirtualBox

Changeset 26684 in vbox


Ignore:
Timestamp:
Feb 22, 2010 4:58:27 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
57909
Message:

Storage/iSCSI: be more robust when a target reports errors for an INQUIRY command, especially don't just blindly look at potentially uninitialized values off the stack.

File:
1 edited

Legend:

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

    r26291 r26684  
    25652565    sr.pvSense = sense;
    25662566
    2567     rc = iscsiCommand(pImage, &sr);
     2567    for (unsigned i = 0; i < 10; i++)
     2568    {
     2569        rc = iscsiCommand(pImage, &sr);
     2570        if (    (RT_SUCCESS(rc) && !sr.cbSense)
     2571            ||  RT_FAILURE(rc))
     2572            break;
     2573        rc = VERR_INVALID_STATE;
     2574    }
    25682575    if (RT_SUCCESS(rc))
    25692576    {
    2570         if ((data8[0] & SCSI_DEVTYPE_MASK) != SCSI_DEVTYPE_DISK)
     2577        uint8_t devType = (sr.cbT2IData > 0) ? data8[0] & SCSI_DEVTYPE_MASK : 255;
     2578        if (devType != SCSI_DEVTYPE_DISK)
    25712579        {
    25722580            rc = iscsiError(pImage, VERR_VD_ISCSI_INVALID_TYPE,
    25732581                            RT_SRC_POS, N_("iSCSI: target address %s, target name %s, SCSI LUN %lld reports device type=%u"),
    25742582                            pImage->pszTargetAddress, pImage->pszTargetName,
    2575                             pImage->LUN, data8[0]);
    2576             LogRel(("iSCSI: Unsupported SCSI peripheral device type %d for target %s\n", data8[0] & SCSI_DEVTYPE_MASK, pImage->pszTargetName));
     2583                            pImage->LUN, devType);
     2584            LogRel(("iSCSI: Unsupported SCSI peripheral device type %d for target %s\n", devType & SCSI_DEVTYPE_MASK, pImage->pszTargetName));
    25772585            goto out;
    25782586        }
Note: See TracChangeset for help on using the changeset viewer.

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