Commit 9acd4122 authored by Nicholas Bellinger's avatar Nicholas Bellinger Committed by Ben Hutchings

iscsi-target: Fix ERL=2 ASYNC_EVENT connection pointer bug

commit d444edc6 upstream.

This patch fixes a long-standing bug in iscsit_build_conn_drop_async_message()
where during ERL=2 connection recovery, a bogus conn_p pointer could
end up being used to send the ISCSI_OP_ASYNC_EVENT + DROPPING_CONNECTION
notifying the initiator that cmd->logout_cid has failed.

The bug was manifesting itself as an OOPs in iscsit_allocate_cmd() with
a bogus conn_p pointer in iscsit_build_conn_drop_async_message().
Reported-by: default avatarArshad Hussain <arshad.hussain@calsoftinc.com>
Reported-by: default avatarsantosh kulkarni <santosh.kulkarni@calsoftinc.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 4c5dd0ae
...@@ -2358,6 +2358,7 @@ static void iscsit_build_conn_drop_async_message(struct iscsi_conn *conn) ...@@ -2358,6 +2358,7 @@ static void iscsit_build_conn_drop_async_message(struct iscsi_conn *conn)
{ {
struct iscsi_cmd *cmd; struct iscsi_cmd *cmd;
struct iscsi_conn *conn_p; struct iscsi_conn *conn_p;
bool found = false;
/* /*
* Only send a Asynchronous Message on connections whos network * Only send a Asynchronous Message on connections whos network
...@@ -2366,11 +2367,12 @@ static void iscsit_build_conn_drop_async_message(struct iscsi_conn *conn) ...@@ -2366,11 +2367,12 @@ static void iscsit_build_conn_drop_async_message(struct iscsi_conn *conn)
list_for_each_entry(conn_p, &conn->sess->sess_conn_list, conn_list) { list_for_each_entry(conn_p, &conn->sess->sess_conn_list, conn_list) {
if (conn_p->conn_state == TARG_CONN_STATE_LOGGED_IN) { if (conn_p->conn_state == TARG_CONN_STATE_LOGGED_IN) {
iscsit_inc_conn_usage_count(conn_p); iscsit_inc_conn_usage_count(conn_p);
found = true;
break; break;
} }
} }
if (!conn_p) if (!found)
return; return;
cmd = iscsit_allocate_cmd(conn_p, GFP_ATOMIC); cmd = iscsit_allocate_cmd(conn_p, GFP_ATOMIC);
......
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