diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2005-11-30 00:12:54 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-12-13 20:11:56 -0500 |
commit | 733bb6a70cb351786f3c2290ab22f71b612e6893 (patch) | |
tree | 3cc08d202d715d3c5c0fe1c8225c8b3558eba47e /drivers/scsi/iscsi_tcp.c | |
parent | e6273993dbcb8d805dd868e2128c3503a3bb1964 (diff) |
[SCSI] iscsi: iscsi response fix
from Wang Zhenyu:
Must check SCSI CMD and R2T response according to the spec
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Alex Aizman <itn780@yahoo.com>
Signed-off-by: Dmitry Yusupov <dmitry_yus@yahoo.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/iscsi_tcp.c')
-rw-r--r-- | drivers/scsi/iscsi_tcp.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index f12d605c7729..e6991515ad2e 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -642,9 +642,7 @@ iscsi_hdr_recv(struct iscsi_conn *conn) | |||
642 | switch(conn->in.opcode) { | 642 | switch(conn->in.opcode) { |
643 | case ISCSI_OP_SCSI_CMD_RSP: | 643 | case ISCSI_OP_SCSI_CMD_RSP: |
644 | BUG_ON((void*)ctask != ctask->sc->SCp.ptr); | 644 | BUG_ON((void*)ctask != ctask->sc->SCp.ptr); |
645 | if (ctask->hdr.flags & ISCSI_FLAG_CMD_WRITE) | 645 | if (!conn->in.datalen) |
646 | rc = iscsi_cmd_rsp(conn, ctask); | ||
647 | else if (!conn->in.datalen) | ||
648 | rc = iscsi_cmd_rsp(conn, ctask); | 646 | rc = iscsi_cmd_rsp(conn, ctask); |
649 | else | 647 | else |
650 | /* | 648 | /* |
@@ -666,8 +664,7 @@ iscsi_hdr_recv(struct iscsi_conn *conn) | |||
666 | break; | 664 | break; |
667 | case ISCSI_OP_R2T: | 665 | case ISCSI_OP_R2T: |
668 | BUG_ON((void*)ctask != ctask->sc->SCp.ptr); | 666 | BUG_ON((void*)ctask != ctask->sc->SCp.ptr); |
669 | if (ctask->hdr.flags & ISCSI_FLAG_CMD_WRITE && | 667 | if (ctask->sc->sc_data_direction == DMA_TO_DEVICE) |
670 | ctask->sc->sc_data_direction == DMA_TO_DEVICE) | ||
671 | rc = iscsi_r2t_rsp(conn, ctask); | 668 | rc = iscsi_r2t_rsp(conn, ctask); |
672 | else | 669 | else |
673 | rc = ISCSI_ERR_PROTO; | 670 | rc = ISCSI_ERR_PROTO; |