Skip to content

Commit

Permalink
[SCSI] qla2xxx: Validate mid-layer 'underflow' during check-condition…
Browse files Browse the repository at this point in the history
… handling.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
  • Loading branch information
Shyam Sundar authored and James Bottomley committed Jul 20, 2007
1 parent 5881569 commit 8084fe1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions drivers/scsi/qla2xxx/qla_isr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,25 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
cp->device->id, cp->device->lun, cp,
cp->serial_number));

/*
* In case of a Underrun condition, set both the lscsi
* status and the completion status to appropriate
* values.
*/
if (resid &&
((unsigned)(cp->request_bufflen - resid) <
cp->underflow)) {
DEBUG2(qla_printk(KERN_INFO, ha,
"scsi(%ld:%d:%d:%d): Mid-layer underflow "
"detected (%x of %x bytes)...returning "
"error status.\n", ha->host_no,
cp->device->channel, cp->device->id,
cp->device->lun, resid,
cp->request_bufflen));

cp->result = DID_ERROR << 16 | lscsi_status;
}

if (sense_len)
DEBUG5(qla2x00_dump_buffer(cp->sense_buffer,
CMD_ACTUAL_SNSLEN(cp)));
Expand Down

0 comments on commit 8084fe1

Please sign in to comment.