Skip to content

Commit

Permalink
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/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>"
  • Loading branch information
Greg Kroah-Hartman committed Sep 19, 2018
2 parents 4ca719a + cbe3fd3 commit 6ad49fa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions drivers/scsi/qla2xxx/qla_target.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ struct atio_from_isp {
static inline int fcpcmd_is_corrupted(struct atio *atio)
{
if (atio->entry_type == ATIO_TYPE7 &&
(le16_to_cpu(atio->attr_n_length & FCP_CMD_LENGTH_MASK) <
FCP_CMD_LENGTH_MIN))
((le16_to_cpu(atio->attr_n_length) & FCP_CMD_LENGTH_MASK) <
FCP_CMD_LENGTH_MIN))
return 1;
else
return 0;
Expand Down
22 changes: 14 additions & 8 deletions drivers/target/iscsi/iscsi_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,8 @@ static void iscsit_do_crypto_hash_buf(struct ahash_request *hash,

sg_init_table(sg, ARRAY_SIZE(sg));
sg_set_buf(sg, buf, payload_length);
sg_set_buf(sg + 1, pad_bytes, padding);
if (padding)
sg_set_buf(sg + 1, pad_bytes, padding);

ahash_request_set_crypt(hash, sg, data_crc, payload_length + padding);

Expand Down Expand Up @@ -3910,18 +3911,21 @@ static bool iscsi_target_check_conn_state(struct iscsi_conn *conn)
static void iscsit_get_rx_pdu(struct iscsi_conn *conn)
{
int ret;
u8 buffer[ISCSI_HDR_LEN], opcode;
u8 *buffer, opcode;
u32 checksum = 0, digest = 0;
struct kvec iov;

buffer = kcalloc(ISCSI_HDR_LEN, sizeof(*buffer), GFP_KERNEL);
if (!buffer)
return;

while (!kthread_should_stop()) {
/*
* Ensure that both TX and RX per connection kthreads
* are scheduled to run on the same CPU.
*/
iscsit_thread_check_cpumask(conn, current, 0);

memset(buffer, 0, ISCSI_HDR_LEN);
memset(&iov, 0, sizeof(struct kvec));

iov.iov_base = buffer;
Expand All @@ -3930,7 +3934,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn)
ret = rx_data(conn, &iov, 1, ISCSI_HDR_LEN);
if (ret != ISCSI_HDR_LEN) {
iscsit_rx_thread_wait_for_tcp(conn);
return;
break;
}

if (conn->conn_ops->HeaderDigest) {
Expand All @@ -3940,7 +3944,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn)
ret = rx_data(conn, &iov, 1, ISCSI_CRC_LEN);
if (ret != ISCSI_CRC_LEN) {
iscsit_rx_thread_wait_for_tcp(conn);
return;
break;
}

iscsit_do_crypto_hash_buf(conn->conn_rx_hash, buffer,
Expand All @@ -3964,7 +3968,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn)
}

if (conn->conn_state == TARG_CONN_STATE_IN_LOGOUT)
return;
break;

opcode = buffer[0] & ISCSI_OPCODE_MASK;

Expand All @@ -3975,13 +3979,15 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn)
" while in Discovery Session, rejecting.\n", opcode);
iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR,
buffer);
return;
break;
}

ret = iscsi_target_rx_opcode(conn, buffer);
if (ret < 0)
return;
break;
}

kfree(buffer);
}

int iscsi_target_rx_thread(void *arg)
Expand Down

0 comments on commit 6ad49fa

Please sign in to comment.