fix 2.6.19 data digest calculation bug
PATCH 1/5 fix 2.6.19 data digest calculation bug
From: Arne Redlich <[email protected]>
The transition from crypto_digest_*() to the crypto_hash_*() family introduced a bug into the data digest calculation: crypto_hash_update() is called with the number of S/G elements instead of the S/G lists data size.
-
--- drivers/scsi/iscsi_tcp.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/iscsi_tcp.c +1 -1
@@ -749,7 +749,7 @@ static int iscsi_scsi_data_in(struct iscif (!offset)crypto_hash_update ( &tcp_conn->rx_hash, - &sg[i],1 ); + &sg[i], sg[i].length);else partial_sg_digest_update( &tcp_conn->rx_hash,
Signature · 1 line
1.4.1.1
PATCH 2/5 iscsi: fix crypto_alloc_hash() error check
From: Akinobu Mita <[email protected]>
The return value of crypto_alloc_hash() should be checked by IS_ERR().
--- drivers/scsi/iscsi_tcp.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/iscsi_tcp.c +2 -2
@@ -1777,13 +1777,13 @@ iscsi_tcp_conn_create(struct iscsi_cls_s tcp_conn->tx_hash.tfm =crypto_alloc_hash ("crc32c" ,0 ,CRYPTO_ALG_ASYNC ); tcp_conn->tx_hash.flags =0 ; -if (!tcp_conn->tx_hash.tfm) +if (IS_ERR (tcp_conn->tx_hash.tfm)) goto free_tcp_conn; tcp_conn->rx_hash.tfm =crypto_alloc_hash ("crc32c" ,0 ,CRYPTO_ALG_ASYNC ); tcp_conn->rx_hash.flags =0 ; -if (!tcp_conn->rx_hash.tfm) +if (IS_ERR (tcp_conn->rx_hash.tfm)) goto free_tx_tfm;return cls_conn;
Signature · 1 line
1.4.1.1
PATCH 3/5 newline in iscsi printk
From: Meelis Roos <[email protected]>
This patch against 2.6.19 cures two runtogether printk messages in iSCSI driver.
--- drivers/scsi/scsi_transport_iscsi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/scsi_transport_iscsi.c +1 -1
@@ -1414,7 +1414,7 @@ static __init int iscsi_transport_init(v {int err; -printk (KERN_INFO "Loading iSCSI transport class v%s." , +printk (KERN_INFO "Loading iSCSI transport class v%s.\n" ,ISCSI_TRANSPORT_VERSION ); err =class_register (&iscsi_transport_class);
Signature · 1 line
1.4.1.1
PATCH 4/5 IPv6 and Linux iSCSI initiator
From: FUJITA Tomonori <[email protected]>
By the way, here's a minor patch to simplify IP address print.
--- drivers/scsi/iscsi_tcp.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/iscsi_tcp.c +2 -4
@@ -2044,13 +2044,11 @@ iscsi_tcp_conn_get_param(struct iscsi_cl sk = tcp_conn->sock->sk;if (sk->sk_family ==PF_INET ) { inet =inet_sk (sk); - len =sprintf (buf,"%u.%u.%u.%u\n" , + len =sprintf (buf,NIPQUAD_FMT "\n" ,NIPQUAD (inet->daddr)); }else { np =inet6_sk (sk); - len =sprintf (buf, -"%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n" , -NIP6 (np->daddr)); + len =sprintf (buf,NIP6_FMT "\n" ,NIP6 (np->daddr)); }mutex_unlock (&conn->xmitmutex);break ;
Signature · 1 line
1.4.1.1
PATCH 5/5 libiscsi: fix senselen calculation
From: Mike Christie <[email protected]>
Yanling Qi, noted that when the sense data length of
a check-condition is greater than 0x7f (127), senselen = (data[0] << 8) | data[1] will become negative. It causes different kinds of panics from GPF, spin_lock deadlock to spin_lock recursion.
We were also swapping this value on big endien machines.
This patch fixes both issues by using be16_to_cpu().
--- drivers/scsi/libiscsi.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/libiscsi.c +3 -3
@@ -260,7 +260,7 @@ static int iscsi_scsi_cmd_rsp(struct isc }if (rhdr->cmd_status ==SAM_STAT_CHECK_CONDITION ) { -int senselen; +uint16_t senselen;if (datalen <2 ) { invalid_datalen:
@@ -270,12 +270,12 @@ invalid_datalen: goto out; } - senselen = (data[0 ] <<8 ) | data[1 ]; + senselen =be16_to_cpu (*(uint16_t *)data);if (datalen < senselen) goto invalid_datalen;memcpy (sc->sense_buffer, data +2 , -min (senselen,SCSI_SENSE_BUFFERSIZE )); +min_t (uint16_t, senselen,SCSI_SENSE_BUFFERSIZE ));debug_scsi ("copied %d bytes of sense\n" ,min (senselen,SCSI_SENSE_BUFFERSIZE )); }
Signature · 1 line
1.4.1.1