Skip to content

Commit 0d95143

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target fixes from Nicholas Bellinger: "Here are the target pending fixes for v3.17-rc6. Included are Sagi's long overdue fixes related to iser-target shutdown, along with a couple of fixes from Sebastian related to ALUA Referrals changes that when in during the v3.14 time-frame. Also included are a few iscsi-target fixes, most recently of which where found during Joern's Coverity scanning of target code" * git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: iscsi-target: avoid NULL pointer in iscsi_copy_param_list failure iscsi-target: Fix memory corruption in iscsit_logout_post_handler_diffcid target: Fix inverted logic in SE_DEV_ALUA_SUPPORT_STATE_STORE target: Fix user data segment multiplier in spc_emulate_evpd_b3() iscsi-target: Ignore ICF_GOT_LAST_DATAOUT during Data-Out ITT lookup Target/iser: Fix initiator_depth and responder_resources Target/iser: Avoid calling rdma_disconnect twice Target/iser: Don't put isert_conn inside disconnected handler Target/iser: Get isert_conn reference once got to connected_handler
2 parents 1734a6e + 8ae757d commit 0d95143

File tree

6 files changed

+19
-13
lines changed

6 files changed

+19
-13
lines changed

drivers/infiniband/ulp/isert/ib_isert.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -586,17 +586,12 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
586586
init_completion(&isert_conn->conn_wait);
587587
init_completion(&isert_conn->conn_wait_comp_err);
588588
kref_init(&isert_conn->conn_kref);
589-
kref_get(&isert_conn->conn_kref);
590589
mutex_init(&isert_conn->conn_mutex);
591590
spin_lock_init(&isert_conn->conn_lock);
592591
INIT_LIST_HEAD(&isert_conn->conn_fr_pool);
593592

594593
cma_id->context = isert_conn;
595594
isert_conn->conn_cm_id = cma_id;
596-
isert_conn->responder_resources = event->param.conn.responder_resources;
597-
isert_conn->initiator_depth = event->param.conn.initiator_depth;
598-
pr_debug("Using responder_resources: %u initiator_depth: %u\n",
599-
isert_conn->responder_resources, isert_conn->initiator_depth);
600595

601596
isert_conn->login_buf = kzalloc(ISCSI_DEF_MAX_RECV_SEG_LEN +
602597
ISER_RX_LOGIN_SIZE, GFP_KERNEL);
@@ -643,6 +638,12 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
643638
goto out_rsp_dma_map;
644639
}
645640

641+
/* Set max inflight RDMA READ requests */
642+
isert_conn->initiator_depth = min_t(u8,
643+
event->param.conn.initiator_depth,
644+
device->dev_attr.max_qp_init_rd_atom);
645+
pr_debug("Using initiator_depth: %u\n", isert_conn->initiator_depth);
646+
646647
isert_conn->conn_device = device;
647648
isert_conn->conn_pd = ib_alloc_pd(isert_conn->conn_device->ib_device);
648649
if (IS_ERR(isert_conn->conn_pd)) {
@@ -746,7 +747,9 @@ isert_connect_release(struct isert_conn *isert_conn)
746747
static void
747748
isert_connected_handler(struct rdma_cm_id *cma_id)
748749
{
749-
return;
750+
struct isert_conn *isert_conn = cma_id->context;
751+
752+
kref_get(&isert_conn->conn_kref);
750753
}
751754

752755
static void
@@ -798,7 +801,6 @@ isert_disconnect_work(struct work_struct *work)
798801

799802
wake_up:
800803
complete(&isert_conn->conn_wait);
801-
isert_put_conn(isert_conn);
802804
}
803805

804806
static void
@@ -3067,7 +3069,6 @@ isert_rdma_accept(struct isert_conn *isert_conn)
30673069
int ret;
30683070

30693071
memset(&cp, 0, sizeof(struct rdma_conn_param));
3070-
cp.responder_resources = isert_conn->responder_resources;
30713072
cp.initiator_depth = isert_conn->initiator_depth;
30723073
cp.retry_count = 7;
30733074
cp.rnr_retry_count = 7;
@@ -3215,7 +3216,7 @@ static void isert_wait_conn(struct iscsi_conn *conn)
32153216
pr_debug("isert_wait_conn: Starting \n");
32163217

32173218
mutex_lock(&isert_conn->conn_mutex);
3218-
if (isert_conn->conn_cm_id) {
3219+
if (isert_conn->conn_cm_id && !isert_conn->disconnect) {
32193220
pr_debug("Calling rdma_disconnect from isert_wait_conn\n");
32203221
rdma_disconnect(isert_conn->conn_cm_id);
32213222
}
@@ -3234,6 +3235,7 @@ static void isert_wait_conn(struct iscsi_conn *conn)
32343235
wait_for_completion(&isert_conn->conn_wait_comp_err);
32353236

32363237
wait_for_completion(&isert_conn->conn_wait);
3238+
isert_put_conn(isert_conn);
32373239
}
32383240

32393241
static void isert_free_conn(struct iscsi_conn *conn)

drivers/target/iscsi/iscsi_target.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4540,6 +4540,7 @@ static void iscsit_logout_post_handler_diffcid(
45404540
{
45414541
struct iscsi_conn *l_conn;
45424542
struct iscsi_session *sess = conn->sess;
4543+
bool conn_found = false;
45434544

45444545
if (!sess)
45454546
return;
@@ -4548,12 +4549,13 @@ static void iscsit_logout_post_handler_diffcid(
45484549
list_for_each_entry(l_conn, &sess->sess_conn_list, conn_list) {
45494550
if (l_conn->cid == cid) {
45504551
iscsit_inc_conn_usage_count(l_conn);
4552+
conn_found = true;
45514553
break;
45524554
}
45534555
}
45544556
spin_unlock_bh(&sess->conn_lock);
45554557

4556-
if (!l_conn)
4558+
if (!conn_found)
45574559
return;
45584560

45594561
if (l_conn->sock)

drivers/target/iscsi/iscsi_target_parameters.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ int iscsi_copy_param_list(
601601
param_list = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL);
602602
if (!param_list) {
603603
pr_err("Unable to allocate memory for struct iscsi_param_list.\n");
604-
goto err_out;
604+
return -1;
605605
}
606606
INIT_LIST_HEAD(&param_list->param_list);
607607
INIT_LIST_HEAD(&param_list->extra_response_list);

drivers/target/iscsi/iscsi_target_util.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,8 @@ struct iscsi_cmd *iscsit_find_cmd_from_itt_or_dump(
400400

401401
spin_lock_bh(&conn->cmd_lock);
402402
list_for_each_entry(cmd, &conn->conn_cmd_list, i_conn_node) {
403+
if (cmd->cmd_flags & ICF_GOT_LAST_DATAOUT)
404+
continue;
403405
if (cmd->init_task_tag == init_task_tag) {
404406
spin_unlock_bh(&conn->cmd_lock);
405407
return cmd;

drivers/target/target_core_configfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2363,7 +2363,7 @@ static ssize_t target_core_alua_tg_pt_gp_store_attr_alua_support_##_name(\
23632363
pr_err("Invalid value '%ld', must be '0' or '1'\n", tmp); \
23642364
return -EINVAL; \
23652365
} \
2366-
if (!tmp) \
2366+
if (tmp) \
23672367
t->_var |= _bit; \
23682368
else \
23692369
t->_var &= ~_bit; \

drivers/target/target_core_spc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ spc_emulate_evpd_b3(struct se_cmd *cmd, unsigned char *buf)
664664
buf[0] = dev->transport->get_device_type(dev);
665665
buf[3] = 0x0c;
666666
put_unaligned_be32(dev->t10_alua.lba_map_segment_size, &buf[8]);
667-
put_unaligned_be32(dev->t10_alua.lba_map_segment_size, &buf[12]);
667+
put_unaligned_be32(dev->t10_alua.lba_map_segment_multiplier, &buf[12]);
668668

669669
return 0;
670670
}

0 commit comments

Comments
 (0)