Target/iser: Don't put isert_conn inside disconnected handler
authorSagi Grimberg <sagig@mellanox.com>
Wed, 2 Jul 2014 13:19:25 +0000 (16:19 +0300)
committerNicholas Bellinger <nab@linux-iscsi.org>
Mon, 15 Sep 2014 21:02:16 +0000 (14:02 -0700)
disconnected_handler is invoked on several CM events (such
as DISCONNECTED, DEVICE_REMOVAL, TIMEWAIT_EXIT...). Since
multiple  events can occur while before isert_free_conn is
invoked, we might put all isert_conn references and free
the connection too early.

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Cc: <stable@vger.kernel.org> # v3.10+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/infiniband/ulp/isert/ib_isert.c

index e318731ffe98f7feddbddf8d89e673de70cc473a..9959cd1faad9685a5efff51980e4ad1dad31d193 100644 (file)
@@ -799,7 +799,6 @@ isert_disconnect_work(struct work_struct *work)
 
 wake_up:
        complete(&isert_conn->conn_wait);
-       isert_put_conn(isert_conn);
 }
 
 static void
@@ -3235,6 +3234,7 @@ static void isert_wait_conn(struct iscsi_conn *conn)
        wait_for_completion(&isert_conn->conn_wait_comp_err);
 
        wait_for_completion(&isert_conn->conn_wait);
+       isert_put_conn(isert_conn);
 }
 
 static void isert_free_conn(struct iscsi_conn *conn)