diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-13 01:38:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-13 01:38:32 -0400 |
commit | ed9ea4ed3a44e8f8e8c7e8a12a05fd73f9ae1fb4 (patch) | |
tree | f7275c1cade0a756d5b456dc23ccb692ff6073d5 /drivers/target/iscsi | |
parent | c1fdb2d3389c5a1e7c559a37a4967c1d2580e75c (diff) | |
parent | 0ed6e189e3f6ac3a25383ed5cc8b0ac24c9b97b7 (diff) |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target updates from Nicholas Bellinger:
"The highlights this round include:
- Add support for T10 PI pass-through between vhost-scsi +
virtio-scsi (MST + Paolo + MKP + nab)
- Add support for T10 PI in qla2xxx target mode (Quinn + MKP + hch +
nab, merged through scsi.git)
- Add support for percpu-ida pre-allocation in qla2xxx target code
(Quinn + nab)
- A number of iser-target fixes related to hardening the network
portal shutdown path (Sagi + Slava)
- Fix response length residual handling for a number of control CDBs
(Roland + Christophe V.)
- Various iscsi RFC conformance fixes in the CHAP authentication path
(Tejas and Calsoft folks + nab)
- Return TASK_SET_FULL status for tcm_fc(FCoE) DataIn + Response
failures (Vasu + Jun + nab)
- Fix long-standing ABORT_TASK + session reset hang (nab)
- Convert iser-initiator + iser-target to include T10 bytes into EDTL
(Sagi + Or + MKP + Mike Christie)
- Fix NULL pointer dereference regression related to XCOPY introduced
in v3.15 + CC'ed to v3.12.y (nab)"
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (34 commits)
target: Fix NULL pointer dereference for XCOPY in target_put_sess_cmd
vhost-scsi: Include prot_bytes into expected data transfer length
TARGET/sbc,loopback: Adjust command data length in case pi exists on the wire
libiscsi, iser: Adjust data_length to include protection information
scsi_cmnd: Introduce scsi_transfer_length helper
target: Report correct response length for some commands
target/sbc: Check that the LBA and number of blocks are correct in VERIFY
target/sbc: Remove sbc_check_valid_sectors()
Target/iscsi: Fix sendtargets response pdu for iser transport
Target/iser: Fix a wrong dereference in case discovery session is over iser
iscsi-target: Fix ABORT_TASK + connection reset iscsi_queue_req memory leak
target: Use complete_all for se_cmd->t_transport_stop_comp
target: Set CMD_T_ACTIVE bit for Task Management Requests
target: cleanup some boolean tests
target/spc: Simplify INQUIRY EVPD=0x80
tcm_fc: Generate TASK_SET_FULL status for response failures
tcm_fc: Generate TASK_SET_FULL status for DataIN failures
iscsi-target: Reject mutual authentication with reflected CHAP_C
iscsi-target: Remove no-op from iscsit_tpg_del_portal_group
iscsi-target: Fix CHAP_A parameter list handling
...
Diffstat (limited to 'drivers/target/iscsi')
-rw-r--r-- | drivers/target/iscsi/iscsi_target.c | 29 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_auth.c | 74 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_auth.h | 1 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_login.c | 2 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_nego.c | 12 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_parameters.c | 14 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_tpg.c | 8 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_tpg.h | 1 |
8 files changed, 98 insertions, 43 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 9189bc0a87ae..5663f4d19d02 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -300,7 +300,7 @@ bool iscsit_check_np_match( | |||
300 | port = ntohs(sock_in->sin_port); | 300 | port = ntohs(sock_in->sin_port); |
301 | } | 301 | } |
302 | 302 | ||
303 | if ((ip_match == true) && (np->np_port == port) && | 303 | if (ip_match && (np->np_port == port) && |
304 | (np->np_network_transport == network_transport)) | 304 | (np->np_network_transport == network_transport)) |
305 | return true; | 305 | return true; |
306 | 306 | ||
@@ -325,7 +325,7 @@ static struct iscsi_np *iscsit_get_np( | |||
325 | } | 325 | } |
326 | 326 | ||
327 | match = iscsit_check_np_match(sockaddr, np, network_transport); | 327 | match = iscsit_check_np_match(sockaddr, np, network_transport); |
328 | if (match == true) { | 328 | if (match) { |
329 | /* | 329 | /* |
330 | * Increment the np_exports reference count now to | 330 | * Increment the np_exports reference count now to |
331 | * prevent iscsit_del_np() below from being called | 331 | * prevent iscsit_del_np() below from being called |
@@ -1121,7 +1121,7 @@ iscsit_get_immediate_data(struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr, | |||
1121 | /* | 1121 | /* |
1122 | * Special case for Unsupported SAM WRITE Opcodes and ImmediateData=Yes. | 1122 | * Special case for Unsupported SAM WRITE Opcodes and ImmediateData=Yes. |
1123 | */ | 1123 | */ |
1124 | if (dump_payload == true) | 1124 | if (dump_payload) |
1125 | goto after_immediate_data; | 1125 | goto after_immediate_data; |
1126 | 1126 | ||
1127 | immed_ret = iscsit_handle_immediate_data(cmd, hdr, | 1127 | immed_ret = iscsit_handle_immediate_data(cmd, hdr, |
@@ -3390,7 +3390,9 @@ static bool iscsit_check_inaddr_any(struct iscsi_np *np) | |||
3390 | 3390 | ||
3391 | #define SENDTARGETS_BUF_LIMIT 32768U | 3391 | #define SENDTARGETS_BUF_LIMIT 32768U |
3392 | 3392 | ||
3393 | static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd) | 3393 | static int |
3394 | iscsit_build_sendtargets_response(struct iscsi_cmd *cmd, | ||
3395 | enum iscsit_transport_type network_transport) | ||
3394 | { | 3396 | { |
3395 | char *payload = NULL; | 3397 | char *payload = NULL; |
3396 | struct iscsi_conn *conn = cmd->conn; | 3398 | struct iscsi_conn *conn = cmd->conn; |
@@ -3467,6 +3469,9 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd) | |||
3467 | struct iscsi_np *np = tpg_np->tpg_np; | 3469 | struct iscsi_np *np = tpg_np->tpg_np; |
3468 | bool inaddr_any = iscsit_check_inaddr_any(np); | 3470 | bool inaddr_any = iscsit_check_inaddr_any(np); |
3469 | 3471 | ||
3472 | if (np->np_network_transport != network_transport) | ||
3473 | continue; | ||
3474 | |||
3470 | if (!target_name_printed) { | 3475 | if (!target_name_printed) { |
3471 | len = sprintf(buf, "TargetName=%s", | 3476 | len = sprintf(buf, "TargetName=%s", |
3472 | tiqn->tiqn); | 3477 | tiqn->tiqn); |
@@ -3485,10 +3490,8 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd) | |||
3485 | 3490 | ||
3486 | len = sprintf(buf, "TargetAddress=" | 3491 | len = sprintf(buf, "TargetAddress=" |
3487 | "%s:%hu,%hu", | 3492 | "%s:%hu,%hu", |
3488 | (inaddr_any == false) ? | 3493 | inaddr_any ? conn->local_ip : np->np_ip, |
3489 | np->np_ip : conn->local_ip, | 3494 | inaddr_any ? conn->local_port : np->np_port, |
3490 | (inaddr_any == false) ? | ||
3491 | np->np_port : conn->local_port, | ||
3492 | tpg->tpgt); | 3495 | tpg->tpgt); |
3493 | len += 1; | 3496 | len += 1; |
3494 | 3497 | ||
@@ -3520,11 +3523,12 @@ eob: | |||
3520 | 3523 | ||
3521 | int | 3524 | int |
3522 | iscsit_build_text_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn, | 3525 | iscsit_build_text_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn, |
3523 | struct iscsi_text_rsp *hdr) | 3526 | struct iscsi_text_rsp *hdr, |
3527 | enum iscsit_transport_type network_transport) | ||
3524 | { | 3528 | { |
3525 | int text_length, padding; | 3529 | int text_length, padding; |
3526 | 3530 | ||
3527 | text_length = iscsit_build_sendtargets_response(cmd); | 3531 | text_length = iscsit_build_sendtargets_response(cmd, network_transport); |
3528 | if (text_length < 0) | 3532 | if (text_length < 0) |
3529 | return text_length; | 3533 | return text_length; |
3530 | 3534 | ||
@@ -3562,7 +3566,7 @@ static int iscsit_send_text_rsp( | |||
3562 | u32 tx_size = 0; | 3566 | u32 tx_size = 0; |
3563 | int text_length, iov_count = 0, rc; | 3567 | int text_length, iov_count = 0, rc; |
3564 | 3568 | ||
3565 | rc = iscsit_build_text_rsp(cmd, conn, hdr); | 3569 | rc = iscsit_build_text_rsp(cmd, conn, hdr, ISCSI_TCP); |
3566 | if (rc < 0) | 3570 | if (rc < 0) |
3567 | return rc; | 3571 | return rc; |
3568 | 3572 | ||
@@ -4234,8 +4238,6 @@ int iscsit_close_connection( | |||
4234 | if (conn->conn_transport->iscsit_wait_conn) | 4238 | if (conn->conn_transport->iscsit_wait_conn) |
4235 | conn->conn_transport->iscsit_wait_conn(conn); | 4239 | conn->conn_transport->iscsit_wait_conn(conn); |
4236 | 4240 | ||
4237 | iscsit_free_queue_reqs_for_conn(conn); | ||
4238 | |||
4239 | /* | 4241 | /* |
4240 | * During Connection recovery drop unacknowledged out of order | 4242 | * During Connection recovery drop unacknowledged out of order |
4241 | * commands for this connection, and prepare the other commands | 4243 | * commands for this connection, and prepare the other commands |
@@ -4252,6 +4254,7 @@ int iscsit_close_connection( | |||
4252 | iscsit_clear_ooo_cmdsns_for_conn(conn); | 4254 | iscsit_clear_ooo_cmdsns_for_conn(conn); |
4253 | iscsit_release_commands_from_conn(conn); | 4255 | iscsit_release_commands_from_conn(conn); |
4254 | } | 4256 | } |
4257 | iscsit_free_queue_reqs_for_conn(conn); | ||
4255 | 4258 | ||
4256 | /* | 4259 | /* |
4257 | * Handle decrementing session or connection usage count if | 4260 | * Handle decrementing session or connection usage count if |
diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c index de77d9aa22c6..19b842c3e0b3 100644 --- a/drivers/target/iscsi/iscsi_target_auth.c +++ b/drivers/target/iscsi/iscsi_target_auth.c | |||
@@ -71,6 +71,40 @@ static void chap_gen_challenge( | |||
71 | challenge_asciihex); | 71 | challenge_asciihex); |
72 | } | 72 | } |
73 | 73 | ||
74 | static int chap_check_algorithm(const char *a_str) | ||
75 | { | ||
76 | char *tmp, *orig, *token; | ||
77 | |||
78 | tmp = kstrdup(a_str, GFP_KERNEL); | ||
79 | if (!tmp) { | ||
80 | pr_err("Memory allocation failed for CHAP_A temporary buffer\n"); | ||
81 | return CHAP_DIGEST_UNKNOWN; | ||
82 | } | ||
83 | orig = tmp; | ||
84 | |||
85 | token = strsep(&tmp, "="); | ||
86 | if (!token) | ||
87 | goto out; | ||
88 | |||
89 | if (strcmp(token, "CHAP_A")) { | ||
90 | pr_err("Unable to locate CHAP_A key\n"); | ||
91 | goto out; | ||
92 | } | ||
93 | while (token) { | ||
94 | token = strsep(&tmp, ","); | ||
95 | if (!token) | ||
96 | goto out; | ||
97 | |||
98 | if (!strncmp(token, "5", 1)) { | ||
99 | pr_debug("Selected MD5 Algorithm\n"); | ||
100 | kfree(orig); | ||
101 | return CHAP_DIGEST_MD5; | ||
102 | } | ||
103 | } | ||
104 | out: | ||
105 | kfree(orig); | ||
106 | return CHAP_DIGEST_UNKNOWN; | ||
107 | } | ||
74 | 108 | ||
75 | static struct iscsi_chap *chap_server_open( | 109 | static struct iscsi_chap *chap_server_open( |
76 | struct iscsi_conn *conn, | 110 | struct iscsi_conn *conn, |
@@ -79,6 +113,7 @@ static struct iscsi_chap *chap_server_open( | |||
79 | char *aic_str, | 113 | char *aic_str, |
80 | unsigned int *aic_len) | 114 | unsigned int *aic_len) |
81 | { | 115 | { |
116 | int ret; | ||
82 | struct iscsi_chap *chap; | 117 | struct iscsi_chap *chap; |
83 | 118 | ||
84 | if (!(auth->naf_flags & NAF_USERID_SET) || | 119 | if (!(auth->naf_flags & NAF_USERID_SET) || |
@@ -93,21 +128,24 @@ static struct iscsi_chap *chap_server_open( | |||
93 | return NULL; | 128 | return NULL; |
94 | 129 | ||
95 | chap = conn->auth_protocol; | 130 | chap = conn->auth_protocol; |
96 | /* | 131 | ret = chap_check_algorithm(a_str); |
97 | * We only support MD5 MDA presently. | 132 | switch (ret) { |
98 | */ | 133 | case CHAP_DIGEST_MD5: |
99 | if (strncmp(a_str, "CHAP_A=5", 8)) { | 134 | pr_debug("[server] Got CHAP_A=5\n"); |
100 | pr_err("CHAP_A is not MD5.\n"); | 135 | /* |
136 | * Send back CHAP_A set to MD5. | ||
137 | */ | ||
138 | *aic_len = sprintf(aic_str, "CHAP_A=5"); | ||
139 | *aic_len += 1; | ||
140 | chap->digest_type = CHAP_DIGEST_MD5; | ||
141 | pr_debug("[server] Sending CHAP_A=%d\n", chap->digest_type); | ||
142 | break; | ||
143 | case CHAP_DIGEST_UNKNOWN: | ||
144 | default: | ||
145 | pr_err("Unsupported CHAP_A value\n"); | ||
101 | return NULL; | 146 | return NULL; |
102 | } | 147 | } |
103 | pr_debug("[server] Got CHAP_A=5\n"); | 148 | |
104 | /* | ||
105 | * Send back CHAP_A set to MD5. | ||
106 | */ | ||
107 | *aic_len = sprintf(aic_str, "CHAP_A=5"); | ||
108 | *aic_len += 1; | ||
109 | chap->digest_type = CHAP_DIGEST_MD5; | ||
110 | pr_debug("[server] Sending CHAP_A=%d\n", chap->digest_type); | ||
111 | /* | 149 | /* |
112 | * Set Identifier. | 150 | * Set Identifier. |
113 | */ | 151 | */ |
@@ -314,6 +352,16 @@ static int chap_server_compute_md5( | |||
314 | goto out; | 352 | goto out; |
315 | } | 353 | } |
316 | /* | 354 | /* |
355 | * During mutual authentication, the CHAP_C generated by the | ||
356 | * initiator must not match the original CHAP_C generated by | ||
357 | * the target. | ||
358 | */ | ||
359 | if (!memcmp(challenge_binhex, chap->challenge, CHAP_CHALLENGE_LENGTH)) { | ||
360 | pr_err("initiator CHAP_C matches target CHAP_C, failing" | ||
361 | " login attempt\n"); | ||
362 | goto out; | ||
363 | } | ||
364 | /* | ||
317 | * Generate CHAP_N and CHAP_R for mutual authentication. | 365 | * Generate CHAP_N and CHAP_R for mutual authentication. |
318 | */ | 366 | */ |
319 | tfm = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC); | 367 | tfm = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC); |
diff --git a/drivers/target/iscsi/iscsi_target_auth.h b/drivers/target/iscsi/iscsi_target_auth.h index 2f463c09626d..d22f7b96a06c 100644 --- a/drivers/target/iscsi/iscsi_target_auth.h +++ b/drivers/target/iscsi/iscsi_target_auth.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _ISCSI_CHAP_H_ | 1 | #ifndef _ISCSI_CHAP_H_ |
2 | #define _ISCSI_CHAP_H_ | 2 | #define _ISCSI_CHAP_H_ |
3 | 3 | ||
4 | #define CHAP_DIGEST_UNKNOWN 0 | ||
4 | #define CHAP_DIGEST_MD5 5 | 5 | #define CHAP_DIGEST_MD5 5 |
5 | #define CHAP_DIGEST_SHA 6 | 6 | #define CHAP_DIGEST_SHA 6 |
6 | 7 | ||
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index d9b1d88e1ad3..fecb69535a15 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
@@ -1145,7 +1145,7 @@ iscsit_conn_set_transport(struct iscsi_conn *conn, struct iscsit_transport *t) | |||
1145 | void iscsi_target_login_sess_out(struct iscsi_conn *conn, | 1145 | void iscsi_target_login_sess_out(struct iscsi_conn *conn, |
1146 | struct iscsi_np *np, bool zero_tsih, bool new_sess) | 1146 | struct iscsi_np *np, bool zero_tsih, bool new_sess) |
1147 | { | 1147 | { |
1148 | if (new_sess == false) | 1148 | if (!new_sess) |
1149 | goto old_sess_out; | 1149 | goto old_sess_out; |
1150 | 1150 | ||
1151 | pr_err("iSCSI Login negotiation failed.\n"); | 1151 | pr_err("iSCSI Login negotiation failed.\n"); |
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c index 75b685960e80..62a095f36bf2 100644 --- a/drivers/target/iscsi/iscsi_target_nego.c +++ b/drivers/target/iscsi/iscsi_target_nego.c | |||
@@ -404,7 +404,7 @@ static void iscsi_target_sk_data_ready(struct sock *sk) | |||
404 | } | 404 | } |
405 | 405 | ||
406 | rc = schedule_delayed_work(&conn->login_work, 0); | 406 | rc = schedule_delayed_work(&conn->login_work, 0); |
407 | if (rc == false) { | 407 | if (!rc) { |
408 | pr_debug("iscsi_target_sk_data_ready, schedule_delayed_work" | 408 | pr_debug("iscsi_target_sk_data_ready, schedule_delayed_work" |
409 | " got false\n"); | 409 | " got false\n"); |
410 | } | 410 | } |
@@ -513,7 +513,7 @@ static void iscsi_target_do_login_rx(struct work_struct *work) | |||
513 | state = (tpg->tpg_state == TPG_STATE_ACTIVE); | 513 | state = (tpg->tpg_state == TPG_STATE_ACTIVE); |
514 | spin_unlock(&tpg->tpg_state_lock); | 514 | spin_unlock(&tpg->tpg_state_lock); |
515 | 515 | ||
516 | if (state == false) { | 516 | if (!state) { |
517 | pr_debug("iscsi_target_do_login_rx: tpg_state != TPG_STATE_ACTIVE\n"); | 517 | pr_debug("iscsi_target_do_login_rx: tpg_state != TPG_STATE_ACTIVE\n"); |
518 | iscsi_target_restore_sock_callbacks(conn); | 518 | iscsi_target_restore_sock_callbacks(conn); |
519 | iscsi_target_login_drop(conn, login); | 519 | iscsi_target_login_drop(conn, login); |
@@ -528,7 +528,7 @@ static void iscsi_target_do_login_rx(struct work_struct *work) | |||
528 | state = iscsi_target_sk_state_check(sk); | 528 | state = iscsi_target_sk_state_check(sk); |
529 | read_unlock_bh(&sk->sk_callback_lock); | 529 | read_unlock_bh(&sk->sk_callback_lock); |
530 | 530 | ||
531 | if (state == false) { | 531 | if (!state) { |
532 | pr_debug("iscsi_target_do_login_rx, TCP state CLOSE\n"); | 532 | pr_debug("iscsi_target_do_login_rx, TCP state CLOSE\n"); |
533 | iscsi_target_restore_sock_callbacks(conn); | 533 | iscsi_target_restore_sock_callbacks(conn); |
534 | iscsi_target_login_drop(conn, login); | 534 | iscsi_target_login_drop(conn, login); |
@@ -773,6 +773,12 @@ static int iscsi_target_handle_csg_zero( | |||
773 | } | 773 | } |
774 | 774 | ||
775 | goto do_auth; | 775 | goto do_auth; |
776 | } else if (!payload_length) { | ||
777 | pr_err("Initiator sent zero length security payload," | ||
778 | " login failed\n"); | ||
779 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_INITIATOR_ERR, | ||
780 | ISCSI_LOGIN_STATUS_AUTH_FAILED); | ||
781 | return -1; | ||
776 | } | 782 | } |
777 | 783 | ||
778 | if (login->first_request) | 784 | if (login->first_request) |
diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c index 4d2e23fc76fd..02f9de26f38a 100644 --- a/drivers/target/iscsi/iscsi_target_parameters.c +++ b/drivers/target/iscsi/iscsi_target_parameters.c | |||
@@ -474,10 +474,10 @@ int iscsi_set_keys_to_negotiate( | |||
474 | if (!strcmp(param->name, AUTHMETHOD)) { | 474 | if (!strcmp(param->name, AUTHMETHOD)) { |
475 | SET_PSTATE_NEGOTIATE(param); | 475 | SET_PSTATE_NEGOTIATE(param); |
476 | } else if (!strcmp(param->name, HEADERDIGEST)) { | 476 | } else if (!strcmp(param->name, HEADERDIGEST)) { |
477 | if (iser == false) | 477 | if (!iser) |
478 | SET_PSTATE_NEGOTIATE(param); | 478 | SET_PSTATE_NEGOTIATE(param); |
479 | } else if (!strcmp(param->name, DATADIGEST)) { | 479 | } else if (!strcmp(param->name, DATADIGEST)) { |
480 | if (iser == false) | 480 | if (!iser) |
481 | SET_PSTATE_NEGOTIATE(param); | 481 | SET_PSTATE_NEGOTIATE(param); |
482 | } else if (!strcmp(param->name, MAXCONNECTIONS)) { | 482 | } else if (!strcmp(param->name, MAXCONNECTIONS)) { |
483 | SET_PSTATE_NEGOTIATE(param); | 483 | SET_PSTATE_NEGOTIATE(param); |
@@ -497,7 +497,7 @@ int iscsi_set_keys_to_negotiate( | |||
497 | } else if (!strcmp(param->name, IMMEDIATEDATA)) { | 497 | } else if (!strcmp(param->name, IMMEDIATEDATA)) { |
498 | SET_PSTATE_NEGOTIATE(param); | 498 | SET_PSTATE_NEGOTIATE(param); |
499 | } else if (!strcmp(param->name, MAXRECVDATASEGMENTLENGTH)) { | 499 | } else if (!strcmp(param->name, MAXRECVDATASEGMENTLENGTH)) { |
500 | if (iser == false) | 500 | if (!iser) |
501 | SET_PSTATE_NEGOTIATE(param); | 501 | SET_PSTATE_NEGOTIATE(param); |
502 | } else if (!strcmp(param->name, MAXXMITDATASEGMENTLENGTH)) { | 502 | } else if (!strcmp(param->name, MAXXMITDATASEGMENTLENGTH)) { |
503 | continue; | 503 | continue; |
@@ -528,13 +528,13 @@ int iscsi_set_keys_to_negotiate( | |||
528 | } else if (!strcmp(param->name, OFMARKINT)) { | 528 | } else if (!strcmp(param->name, OFMARKINT)) { |
529 | SET_PSTATE_NEGOTIATE(param); | 529 | SET_PSTATE_NEGOTIATE(param); |
530 | } else if (!strcmp(param->name, RDMAEXTENSIONS)) { | 530 | } else if (!strcmp(param->name, RDMAEXTENSIONS)) { |
531 | if (iser == true) | 531 | if (iser) |
532 | SET_PSTATE_NEGOTIATE(param); | 532 | SET_PSTATE_NEGOTIATE(param); |
533 | } else if (!strcmp(param->name, INITIATORRECVDATASEGMENTLENGTH)) { | 533 | } else if (!strcmp(param->name, INITIATORRECVDATASEGMENTLENGTH)) { |
534 | if (iser == true) | 534 | if (iser) |
535 | SET_PSTATE_NEGOTIATE(param); | 535 | SET_PSTATE_NEGOTIATE(param); |
536 | } else if (!strcmp(param->name, TARGETRECVDATASEGMENTLENGTH)) { | 536 | } else if (!strcmp(param->name, TARGETRECVDATASEGMENTLENGTH)) { |
537 | if (iser == true) | 537 | if (iser) |
538 | SET_PSTATE_NEGOTIATE(param); | 538 | SET_PSTATE_NEGOTIATE(param); |
539 | } | 539 | } |
540 | } | 540 | } |
@@ -1605,7 +1605,7 @@ int iscsi_decode_text_input( | |||
1605 | 1605 | ||
1606 | tmpbuf = kzalloc(length + 1, GFP_KERNEL); | 1606 | tmpbuf = kzalloc(length + 1, GFP_KERNEL); |
1607 | if (!tmpbuf) { | 1607 | if (!tmpbuf) { |
1608 | pr_err("Unable to allocate memory for tmpbuf.\n"); | 1608 | pr_err("Unable to allocate %u + 1 bytes for tmpbuf.\n", length); |
1609 | return -1; | 1609 | return -1; |
1610 | } | 1610 | } |
1611 | 1611 | ||
diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c index 1431e8400d28..c3cb5c15efda 100644 --- a/drivers/target/iscsi/iscsi_target_tpg.c +++ b/drivers/target/iscsi/iscsi_target_tpg.c | |||
@@ -189,7 +189,7 @@ static void iscsit_clear_tpg_np_login_thread( | |||
189 | iscsit_reset_np_thread(tpg_np->tpg_np, tpg_np, tpg, shutdown); | 189 | iscsit_reset_np_thread(tpg_np->tpg_np, tpg_np, tpg, shutdown); |
190 | } | 190 | } |
191 | 191 | ||
192 | void iscsit_clear_tpg_np_login_threads( | 192 | static void iscsit_clear_tpg_np_login_threads( |
193 | struct iscsi_portal_group *tpg, | 193 | struct iscsi_portal_group *tpg, |
194 | bool shutdown) | 194 | bool shutdown) |
195 | { | 195 | { |
@@ -276,8 +276,6 @@ int iscsit_tpg_del_portal_group( | |||
276 | tpg->tpg_state = TPG_STATE_INACTIVE; | 276 | tpg->tpg_state = TPG_STATE_INACTIVE; |
277 | spin_unlock(&tpg->tpg_state_lock); | 277 | spin_unlock(&tpg->tpg_state_lock); |
278 | 278 | ||
279 | iscsit_clear_tpg_np_login_threads(tpg, true); | ||
280 | |||
281 | if (iscsit_release_sessions_for_tpg(tpg, force) < 0) { | 279 | if (iscsit_release_sessions_for_tpg(tpg, force) < 0) { |
282 | pr_err("Unable to delete iSCSI Target Portal Group:" | 280 | pr_err("Unable to delete iSCSI Target Portal Group:" |
283 | " %hu while active sessions exist, and force=0\n", | 281 | " %hu while active sessions exist, and force=0\n", |
@@ -453,7 +451,7 @@ static bool iscsit_tpg_check_network_portal( | |||
453 | 451 | ||
454 | match = iscsit_check_np_match(sockaddr, np, | 452 | match = iscsit_check_np_match(sockaddr, np, |
455 | network_transport); | 453 | network_transport); |
456 | if (match == true) | 454 | if (match) |
457 | break; | 455 | break; |
458 | } | 456 | } |
459 | spin_unlock(&tpg->tpg_np_lock); | 457 | spin_unlock(&tpg->tpg_np_lock); |
@@ -475,7 +473,7 @@ struct iscsi_tpg_np *iscsit_tpg_add_network_portal( | |||
475 | 473 | ||
476 | if (!tpg_np_parent) { | 474 | if (!tpg_np_parent) { |
477 | if (iscsit_tpg_check_network_portal(tpg->tpg_tiqn, sockaddr, | 475 | if (iscsit_tpg_check_network_portal(tpg->tpg_tiqn, sockaddr, |
478 | network_transport) == true) { | 476 | network_transport)) { |
479 | pr_err("Network Portal: %s already exists on a" | 477 | pr_err("Network Portal: %s already exists on a" |
480 | " different TPG on %s\n", ip_str, | 478 | " different TPG on %s\n", ip_str, |
481 | tpg->tpg_tiqn->tiqn); | 479 | tpg->tpg_tiqn->tiqn); |
diff --git a/drivers/target/iscsi/iscsi_target_tpg.h b/drivers/target/iscsi/iscsi_target_tpg.h index 0a182f2aa8a2..e7265337bc43 100644 --- a/drivers/target/iscsi/iscsi_target_tpg.h +++ b/drivers/target/iscsi/iscsi_target_tpg.h | |||
@@ -8,7 +8,6 @@ extern struct iscsi_portal_group *iscsit_get_tpg_from_np(struct iscsi_tiqn *, | |||
8 | struct iscsi_np *, struct iscsi_tpg_np **); | 8 | struct iscsi_np *, struct iscsi_tpg_np **); |
9 | extern int iscsit_get_tpg(struct iscsi_portal_group *); | 9 | extern int iscsit_get_tpg(struct iscsi_portal_group *); |
10 | extern void iscsit_put_tpg(struct iscsi_portal_group *); | 10 | extern void iscsit_put_tpg(struct iscsi_portal_group *); |
11 | extern void iscsit_clear_tpg_np_login_threads(struct iscsi_portal_group *, bool); | ||
12 | extern void iscsit_tpg_dump_params(struct iscsi_portal_group *); | 11 | extern void iscsit_tpg_dump_params(struct iscsi_portal_group *); |
13 | extern int iscsit_tpg_add_portal_group(struct iscsi_tiqn *, struct iscsi_portal_group *); | 12 | extern int iscsit_tpg_add_portal_group(struct iscsi_tiqn *, struct iscsi_portal_group *); |
14 | extern int iscsit_tpg_del_portal_group(struct iscsi_tiqn *, struct iscsi_portal_group *, | 13 | extern int iscsit_tpg_del_portal_group(struct iscsi_tiqn *, struct iscsi_portal_group *, |