diff options
Diffstat (limited to 'drivers/scsi/libiscsi.c')
-rw-r--r-- | drivers/scsi/libiscsi.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 176458f35316..0beb4c620962 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -291,17 +291,19 @@ invalid_datalen: | |||
291 | min_t(uint16_t, senselen, SCSI_SENSE_BUFFERSIZE)); | 291 | min_t(uint16_t, senselen, SCSI_SENSE_BUFFERSIZE)); |
292 | } | 292 | } |
293 | 293 | ||
294 | if (rhdr->flags & ISCSI_FLAG_CMD_UNDERFLOW) { | 294 | if (rhdr->flags & (ISCSI_FLAG_CMD_UNDERFLOW | |
295 | ISCSI_FLAG_CMD_OVERFLOW)) { | ||
295 | int res_count = be32_to_cpu(rhdr->residual_count); | 296 | int res_count = be32_to_cpu(rhdr->residual_count); |
296 | 297 | ||
297 | if (res_count > 0 && res_count <= scsi_bufflen(sc)) | 298 | if (res_count > 0 && |
299 | (rhdr->flags & ISCSI_FLAG_CMD_OVERFLOW || | ||
300 | res_count <= scsi_bufflen(sc))) | ||
298 | scsi_set_resid(sc, res_count); | 301 | scsi_set_resid(sc, res_count); |
299 | else | 302 | else |
300 | sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status; | 303 | sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status; |
301 | } else if (rhdr->flags & ISCSI_FLAG_CMD_BIDI_UNDERFLOW) | 304 | } else if (rhdr->flags & (ISCSI_FLAG_CMD_BIDI_UNDERFLOW | |
305 | ISCSI_FLAG_CMD_BIDI_OVERFLOW)) | ||
302 | sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status; | 306 | sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status; |
303 | else if (rhdr->flags & ISCSI_FLAG_CMD_OVERFLOW) | ||
304 | scsi_set_resid(sc, be32_to_cpu(rhdr->residual_count)); | ||
305 | 307 | ||
306 | out: | 308 | out: |
307 | debug_scsi("done [sc %lx res %d itt 0x%x]\n", | 309 | debug_scsi("done [sc %lx res %d itt 0x%x]\n", |