diff options
Diffstat (limited to 'drivers/scsi/iscsi_tcp.c')
-rw-r--r-- | drivers/scsi/iscsi_tcp.c | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index b6f99dfbb038..8a178674cb18 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -629,8 +629,9 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
629 | int rc; | 629 | int rc; |
630 | 630 | ||
631 | if (tcp_conn->in.datalen) { | 631 | if (tcp_conn->in.datalen) { |
632 | printk(KERN_ERR "iscsi_tcp: invalid R2t with datalen %d\n", | 632 | iscsi_conn_printk(KERN_ERR, conn, |
633 | tcp_conn->in.datalen); | 633 | "invalid R2t with datalen %d\n", |
634 | tcp_conn->in.datalen); | ||
634 | return ISCSI_ERR_DATALEN; | 635 | return ISCSI_ERR_DATALEN; |
635 | } | 636 | } |
636 | 637 | ||
@@ -644,8 +645,9 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
644 | iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr); | 645 | iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr); |
645 | 646 | ||
646 | if (!ctask->sc || session->state != ISCSI_STATE_LOGGED_IN) { | 647 | if (!ctask->sc || session->state != ISCSI_STATE_LOGGED_IN) { |
647 | printk(KERN_INFO "iscsi_tcp: dropping R2T itt %d in " | 648 | iscsi_conn_printk(KERN_INFO, conn, |
648 | "recovery...\n", ctask->itt); | 649 | "dropping R2T itt %d in recovery.\n", |
650 | ctask->itt); | ||
649 | return 0; | 651 | return 0; |
650 | } | 652 | } |
651 | 653 | ||
@@ -655,7 +657,8 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
655 | r2t->exp_statsn = rhdr->statsn; | 657 | r2t->exp_statsn = rhdr->statsn; |
656 | r2t->data_length = be32_to_cpu(rhdr->data_length); | 658 | r2t->data_length = be32_to_cpu(rhdr->data_length); |
657 | if (r2t->data_length == 0) { | 659 | if (r2t->data_length == 0) { |
658 | printk(KERN_ERR "iscsi_tcp: invalid R2T with zero data len\n"); | 660 | iscsi_conn_printk(KERN_ERR, conn, |
661 | "invalid R2T with zero data len\n"); | ||
659 | __kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t, | 662 | __kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t, |
660 | sizeof(void*)); | 663 | sizeof(void*)); |
661 | return ISCSI_ERR_DATALEN; | 664 | return ISCSI_ERR_DATALEN; |
@@ -668,9 +671,10 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
668 | 671 | ||
669 | r2t->data_offset = be32_to_cpu(rhdr->data_offset); | 672 | r2t->data_offset = be32_to_cpu(rhdr->data_offset); |
670 | if (r2t->data_offset + r2t->data_length > scsi_bufflen(ctask->sc)) { | 673 | if (r2t->data_offset + r2t->data_length > scsi_bufflen(ctask->sc)) { |
671 | printk(KERN_ERR "iscsi_tcp: invalid R2T with data len %u at " | 674 | iscsi_conn_printk(KERN_ERR, conn, |
672 | "offset %u and total length %d\n", r2t->data_length, | 675 | "invalid R2T with data len %u at offset %u " |
673 | r2t->data_offset, scsi_bufflen(ctask->sc)); | 676 | "and total length %d\n", r2t->data_length, |
677 | r2t->data_offset, scsi_bufflen(ctask->sc)); | ||
674 | __kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t, | 678 | __kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t, |
675 | sizeof(void*)); | 679 | sizeof(void*)); |
676 | return ISCSI_ERR_DATALEN; | 680 | return ISCSI_ERR_DATALEN; |
@@ -736,8 +740,9 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) | |||
736 | /* verify PDU length */ | 740 | /* verify PDU length */ |
737 | tcp_conn->in.datalen = ntoh24(hdr->dlength); | 741 | tcp_conn->in.datalen = ntoh24(hdr->dlength); |
738 | if (tcp_conn->in.datalen > conn->max_recv_dlength) { | 742 | if (tcp_conn->in.datalen > conn->max_recv_dlength) { |
739 | printk(KERN_ERR "iscsi_tcp: datalen %d > %d\n", | 743 | iscsi_conn_printk(KERN_ERR, conn, |
740 | tcp_conn->in.datalen, conn->max_recv_dlength); | 744 | "iscsi_tcp: datalen %d > %d\n", |
745 | tcp_conn->in.datalen, conn->max_recv_dlength); | ||
741 | return ISCSI_ERR_DATALEN; | 746 | return ISCSI_ERR_DATALEN; |
742 | } | 747 | } |
743 | 748 | ||
@@ -819,10 +824,12 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) | |||
819 | * For now we fail until we find a vendor that needs it | 824 | * For now we fail until we find a vendor that needs it |
820 | */ | 825 | */ |
821 | if (ISCSI_DEF_MAX_RECV_SEG_LEN < tcp_conn->in.datalen) { | 826 | if (ISCSI_DEF_MAX_RECV_SEG_LEN < tcp_conn->in.datalen) { |
822 | printk(KERN_ERR "iscsi_tcp: received buffer of len %u " | 827 | iscsi_conn_printk(KERN_ERR, conn, |
823 | "but conn buffer is only %u (opcode %0x)\n", | 828 | "iscsi_tcp: received buffer of " |
824 | tcp_conn->in.datalen, | 829 | "len %u but conn buffer is only %u " |
825 | ISCSI_DEF_MAX_RECV_SEG_LEN, opcode); | 830 | "(opcode %0x)\n", |
831 | tcp_conn->in.datalen, | ||
832 | ISCSI_DEF_MAX_RECV_SEG_LEN, opcode); | ||
826 | rc = ISCSI_ERR_PROTO; | 833 | rc = ISCSI_ERR_PROTO; |
827 | break; | 834 | break; |
828 | } | 835 | } |
@@ -1496,30 +1503,25 @@ iscsi_tcp_conn_create(struct iscsi_cls_session *cls_session, uint32_t conn_idx) | |||
1496 | tcp_conn->tx_hash.tfm = crypto_alloc_hash("crc32c", 0, | 1503 | tcp_conn->tx_hash.tfm = crypto_alloc_hash("crc32c", 0, |
1497 | CRYPTO_ALG_ASYNC); | 1504 | CRYPTO_ALG_ASYNC); |
1498 | tcp_conn->tx_hash.flags = 0; | 1505 | tcp_conn->tx_hash.flags = 0; |
1499 | if (IS_ERR(tcp_conn->tx_hash.tfm)) { | 1506 | if (IS_ERR(tcp_conn->tx_hash.tfm)) |
1500 | printk(KERN_ERR "Could not create connection due to crc32c " | ||
1501 | "loading error %ld. Make sure the crc32c module is " | ||
1502 | "built as a module or into the kernel\n", | ||
1503 | PTR_ERR(tcp_conn->tx_hash.tfm)); | ||
1504 | goto free_tcp_conn; | 1507 | goto free_tcp_conn; |
1505 | } | ||
1506 | 1508 | ||
1507 | tcp_conn->rx_hash.tfm = crypto_alloc_hash("crc32c", 0, | 1509 | tcp_conn->rx_hash.tfm = crypto_alloc_hash("crc32c", 0, |
1508 | CRYPTO_ALG_ASYNC); | 1510 | CRYPTO_ALG_ASYNC); |
1509 | tcp_conn->rx_hash.flags = 0; | 1511 | tcp_conn->rx_hash.flags = 0; |
1510 | if (IS_ERR(tcp_conn->rx_hash.tfm)) { | 1512 | if (IS_ERR(tcp_conn->rx_hash.tfm)) |
1511 | printk(KERN_ERR "Could not create connection due to crc32c " | ||
1512 | "loading error %ld. Make sure the crc32c module is " | ||
1513 | "built as a module or into the kernel\n", | ||
1514 | PTR_ERR(tcp_conn->rx_hash.tfm)); | ||
1515 | goto free_tx_tfm; | 1513 | goto free_tx_tfm; |
1516 | } | ||
1517 | 1514 | ||
1518 | return cls_conn; | 1515 | return cls_conn; |
1519 | 1516 | ||
1520 | free_tx_tfm: | 1517 | free_tx_tfm: |
1521 | crypto_free_hash(tcp_conn->tx_hash.tfm); | 1518 | crypto_free_hash(tcp_conn->tx_hash.tfm); |
1522 | free_tcp_conn: | 1519 | free_tcp_conn: |
1520 | iscsi_conn_printk(KERN_ERR, conn, | ||
1521 | "Could not create connection due to crc32c " | ||
1522 | "loading error. Make sure the crc32c " | ||
1523 | "module is built as a module or into the " | ||
1524 | "kernel\n"); | ||
1523 | kfree(tcp_conn); | 1525 | kfree(tcp_conn); |
1524 | tcp_conn_alloc_fail: | 1526 | tcp_conn_alloc_fail: |
1525 | iscsi_conn_teardown(cls_conn); | 1527 | iscsi_conn_teardown(cls_conn); |
@@ -1627,7 +1629,8 @@ iscsi_tcp_conn_bind(struct iscsi_cls_session *cls_session, | |||
1627 | /* lookup for existing socket */ | 1629 | /* lookup for existing socket */ |
1628 | sock = sockfd_lookup((int)transport_eph, &err); | 1630 | sock = sockfd_lookup((int)transport_eph, &err); |
1629 | if (!sock) { | 1631 | if (!sock) { |
1630 | printk(KERN_ERR "iscsi_tcp: sockfd_lookup failed %d\n", err); | 1632 | iscsi_conn_printk(KERN_ERR, conn, |
1633 | "sockfd_lookup failed %d\n", err); | ||
1631 | return -EEXIST; | 1634 | return -EEXIST; |
1632 | } | 1635 | } |
1633 | /* | 1636 | /* |