diff options
Diffstat (limited to 'drivers/scsi/iscsi_tcp.c')
-rw-r--r-- | drivers/scsi/iscsi_tcp.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index dfaf9fa57340..f2a08f7ed902 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -740,7 +740,6 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) | |||
740 | struct iscsi_session *session = conn->session; | 740 | struct iscsi_session *session = conn->session; |
741 | struct iscsi_tcp_conn *tcp_conn = conn->dd_data; | 741 | struct iscsi_tcp_conn *tcp_conn = conn->dd_data; |
742 | struct iscsi_cmd_task *ctask; | 742 | struct iscsi_cmd_task *ctask; |
743 | uint32_t itt; | ||
744 | 743 | ||
745 | /* verify PDU length */ | 744 | /* verify PDU length */ |
746 | tcp_conn->in.datalen = ntoh24(hdr->dlength); | 745 | tcp_conn->in.datalen = ntoh24(hdr->dlength); |
@@ -758,7 +757,7 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) | |||
758 | 757 | ||
759 | opcode = hdr->opcode & ISCSI_OPCODE_MASK; | 758 | opcode = hdr->opcode & ISCSI_OPCODE_MASK; |
760 | /* verify itt (itt encoding: age+cid+itt) */ | 759 | /* verify itt (itt encoding: age+cid+itt) */ |
761 | rc = iscsi_verify_itt(conn, hdr, &itt); | 760 | rc = iscsi_verify_itt(conn, hdr->itt); |
762 | if (rc) | 761 | if (rc) |
763 | return rc; | 762 | return rc; |
764 | 763 | ||
@@ -767,7 +766,10 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) | |||
767 | 766 | ||
768 | switch(opcode) { | 767 | switch(opcode) { |
769 | case ISCSI_OP_SCSI_DATA_IN: | 768 | case ISCSI_OP_SCSI_DATA_IN: |
770 | ctask = session->cmds[itt]; | 769 | ctask = iscsi_itt_to_ctask(conn, hdr->itt); |
770 | if (!ctask) | ||
771 | return ISCSI_ERR_BAD_ITT; | ||
772 | |||
771 | spin_lock(&conn->session->lock); | 773 | spin_lock(&conn->session->lock); |
772 | rc = iscsi_data_rsp(conn, ctask); | 774 | rc = iscsi_data_rsp(conn, ctask); |
773 | spin_unlock(&conn->session->lock); | 775 | spin_unlock(&conn->session->lock); |
@@ -810,7 +812,10 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) | |||
810 | rc = iscsi_complete_pdu(conn, hdr, NULL, 0); | 812 | rc = iscsi_complete_pdu(conn, hdr, NULL, 0); |
811 | break; | 813 | break; |
812 | case ISCSI_OP_R2T: | 814 | case ISCSI_OP_R2T: |
813 | ctask = session->cmds[itt]; | 815 | ctask = iscsi_itt_to_ctask(conn, hdr->itt); |
816 | if (!ctask) | ||
817 | return ISCSI_ERR_BAD_ITT; | ||
818 | |||
814 | if (ahslen) | 819 | if (ahslen) |
815 | rc = ISCSI_ERR_AHSLEN; | 820 | rc = ISCSI_ERR_AHSLEN; |
816 | else if (ctask->sc->sc_data_direction == DMA_TO_DEVICE) { | 821 | else if (ctask->sc->sc_data_direction == DMA_TO_DEVICE) { |