Skip to content

Commit d444edc

Browse files
author
Nicholas Bellinger
committed
iscsi-target: Fix ERL=2 ASYNC_EVENT connection pointer bug
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: Arshad Hussain <arshad.hussain@calsoftinc.com> Reported-by: santosh kulkarni <santosh.kulkarni@calsoftinc.com> Cc: <stable@vger.kernel.org> raspberrypi#3.1+ Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
1 parent f225225 commit d444edc

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎drivers/target/iscsi/iscsi_target.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2491,6 +2491,7 @@ static void iscsit_build_conn_drop_async_message(struct iscsi_conn *conn)
24912491
{
24922492
struct iscsi_cmd *cmd;
24932493
struct iscsi_conn *conn_p;
2494+
bool found = false;
24942495

24952496
/*
24962497
* Only send a Asynchronous Message on connections whos network
@@ -2499,11 +2500,12 @@ static void iscsit_build_conn_drop_async_message(struct iscsi_conn *conn)
24992500
list_for_each_entry(conn_p, &conn->sess->sess_conn_list, conn_list) {
25002501
if (conn_p->conn_state == TARG_CONN_STATE_LOGGED_IN) {
25012502
iscsit_inc_conn_usage_count(conn_p);
2503+
found = true;
25022504
break;
25032505
}
25042506
}
25052507

2506-
if (!conn_p)
2508+
if (!found)
25072509
return;
25082510

25092511
cmd = iscsit_allocate_cmd(conn_p, TASK_RUNNING);

0 commit comments

Comments
 (0)