On Mon, 2010-05-10 at 04:24 -0700, Rajashekhara, Mahesh wrote: > diff -ru a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c > --- a/drivers/scsi/aacraid/aachba.c 2010-05-13 12:50:36.684220912 -0700 > +++ b/drivers/scsi/aacraid/aachba.c 2010-05-13 12:59:59.412673184 -0700 > @@ -1598,6 +1598,7 @@ > int status; > struct aac_dev *dev; > struct fib * cmd_fibcontext; > + int cid; > > dev = (struct aac_dev *)scsicmd->device->host->hostdata; > /* > @@ -1647,6 +1648,22 @@ > count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8]; > break; > } > + > + if ((lba + count) > (dev->fsa_dev[scmd_id(scsicmd)].size)) { > + cid = scmd_id(scsicmd); > + dprintk((KERN_DEBUG "aacraid: Illegal lba\n")); > + scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | > + SAM_STAT_CHECK_CONDITION; > + set_sense(&dev->fsa_dev[cid].sense_data, > + HARDWARE_ERROR, SENCODE_INTERNAL_TARGET_FAILURE, > + ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0); > + memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, > + min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data), > + SCSI_SENSE_BUFFERSIZE)); > + scsicmd->scsi_done(scsicmd); > + return 1; > + } > + > dprintk((KERN_DEBUG "aac_read[cpu %d]: lba = %llu, t = %ld.\n", > smp_processor_id(), (unsigned long long)lba, jiffies)); > if (aac_adapter_bounds(dev,scsicmd,lba)) > @@ -1688,6 +1705,7 @@ > int status; > struct aac_dev *dev; > struct fib * cmd_fibcontext; > + int cid; > > dev = (struct aac_dev *)scsicmd->device->host->hostdata; > /* > @@ -1727,6 +1745,22 @@ > count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8]; > fua = scsicmd->cmnd[1] & 0x8; > } > + > + if ((lba + count) > (dev->fsa_dev[scmd_id(scsicmd)].size)) { > + cid = scmd_id(scsicmd); > + dprintk((KERN_DEBUG "aacraid: Illegal lba\n")); > + scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | > + SAM_STAT_CHECK_CONDITION; > + set_sense(&dev->fsa_dev[cid].sense_data, > + HARDWARE_ERROR, SENCODE_INTERNAL_TARGET_FAILURE, > + ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0); > + memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, > + min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data), > + SCSI_SENSE_BUFFERSIZE)); > + scsicmd->scsi_done(scsicmd); > + return 1; > + } > + > dprintk((KERN_DEBUG "aac_write[cpu %d]: lba = %llu, t = %ld.\n", > smp_processor_id(), (unsigned long long)lba, jiffies)); > if (aac_adapter_bounds(dev,scsicmd,lba)) For some reason, this patch is whitespace damaged ... all the tabs have become spaces ... I fixed it up (for this one time). James -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html