Commit 6ad49fa1 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

James writes:
  "SCSI fixes on 20180919

   A couple of small but important fixes, one affecting big endian and
   the other fixing a BUG_ON in scatterlist processing.

   Signed-off-by: James E.J. Bottomley <jejb@linux.ibm.com>"
parents 4ca719a3 cbe3fd39
...@@ -374,7 +374,7 @@ struct atio_from_isp { ...@@ -374,7 +374,7 @@ struct atio_from_isp {
static inline int fcpcmd_is_corrupted(struct atio *atio) static inline int fcpcmd_is_corrupted(struct atio *atio)
{ {
if (atio->entry_type == ATIO_TYPE7 && if (atio->entry_type == ATIO_TYPE7 &&
(le16_to_cpu(atio->attr_n_length & FCP_CMD_LENGTH_MASK) < ((le16_to_cpu(atio->attr_n_length) & FCP_CMD_LENGTH_MASK) <
FCP_CMD_LENGTH_MIN)) FCP_CMD_LENGTH_MIN))
return 1; return 1;
else else
......
...@@ -1416,6 +1416,7 @@ static void iscsit_do_crypto_hash_buf(struct ahash_request *hash, ...@@ -1416,6 +1416,7 @@ static void iscsit_do_crypto_hash_buf(struct ahash_request *hash,
sg_init_table(sg, ARRAY_SIZE(sg)); sg_init_table(sg, ARRAY_SIZE(sg));
sg_set_buf(sg, buf, payload_length); sg_set_buf(sg, buf, payload_length);
if (padding)
sg_set_buf(sg + 1, pad_bytes, padding); sg_set_buf(sg + 1, pad_bytes, padding);
ahash_request_set_crypt(hash, sg, data_crc, payload_length + padding); ahash_request_set_crypt(hash, sg, data_crc, payload_length + padding);
...@@ -3910,10 +3911,14 @@ static bool iscsi_target_check_conn_state(struct iscsi_conn *conn) ...@@ -3910,10 +3911,14 @@ static bool iscsi_target_check_conn_state(struct iscsi_conn *conn)
static void iscsit_get_rx_pdu(struct iscsi_conn *conn) static void iscsit_get_rx_pdu(struct iscsi_conn *conn)
{ {
int ret; int ret;
u8 buffer[ISCSI_HDR_LEN], opcode; u8 *buffer, opcode;
u32 checksum = 0, digest = 0; u32 checksum = 0, digest = 0;
struct kvec iov; struct kvec iov;
buffer = kcalloc(ISCSI_HDR_LEN, sizeof(*buffer), GFP_KERNEL);
if (!buffer)
return;
while (!kthread_should_stop()) { while (!kthread_should_stop()) {
/* /*
* Ensure that both TX and RX per connection kthreads * Ensure that both TX and RX per connection kthreads
...@@ -3921,7 +3926,6 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) ...@@ -3921,7 +3926,6 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn)
*/ */
iscsit_thread_check_cpumask(conn, current, 0); iscsit_thread_check_cpumask(conn, current, 0);
memset(buffer, 0, ISCSI_HDR_LEN);
memset(&iov, 0, sizeof(struct kvec)); memset(&iov, 0, sizeof(struct kvec));
iov.iov_base = buffer; iov.iov_base = buffer;
...@@ -3930,7 +3934,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) ...@@ -3930,7 +3934,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn)
ret = rx_data(conn, &iov, 1, ISCSI_HDR_LEN); ret = rx_data(conn, &iov, 1, ISCSI_HDR_LEN);
if (ret != ISCSI_HDR_LEN) { if (ret != ISCSI_HDR_LEN) {
iscsit_rx_thread_wait_for_tcp(conn); iscsit_rx_thread_wait_for_tcp(conn);
return; break;
} }
if (conn->conn_ops->HeaderDigest) { if (conn->conn_ops->HeaderDigest) {
...@@ -3940,7 +3944,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) ...@@ -3940,7 +3944,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn)
ret = rx_data(conn, &iov, 1, ISCSI_CRC_LEN); ret = rx_data(conn, &iov, 1, ISCSI_CRC_LEN);
if (ret != ISCSI_CRC_LEN) { if (ret != ISCSI_CRC_LEN) {
iscsit_rx_thread_wait_for_tcp(conn); iscsit_rx_thread_wait_for_tcp(conn);
return; break;
} }
iscsit_do_crypto_hash_buf(conn->conn_rx_hash, buffer, iscsit_do_crypto_hash_buf(conn->conn_rx_hash, buffer,
...@@ -3964,7 +3968,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) ...@@ -3964,7 +3968,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn)
} }
if (conn->conn_state == TARG_CONN_STATE_IN_LOGOUT) if (conn->conn_state == TARG_CONN_STATE_IN_LOGOUT)
return; break;
opcode = buffer[0] & ISCSI_OPCODE_MASK; opcode = buffer[0] & ISCSI_OPCODE_MASK;
...@@ -3975,13 +3979,15 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) ...@@ -3975,13 +3979,15 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn)
" while in Discovery Session, rejecting.\n", opcode); " while in Discovery Session, rejecting.\n", opcode);
iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR, iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR,
buffer); buffer);
return; break;
} }
ret = iscsi_target_rx_opcode(conn, buffer); ret = iscsi_target_rx_opcode(conn, buffer);
if (ret < 0) if (ret < 0)
return; break;
} }
kfree(buffer);
} }
int iscsi_target_rx_thread(void *arg) int iscsi_target_rx_thread(void *arg)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment