[PATCH 3.16 151/328] iscsi-target: nullify session in failed login sequence

Ben Hutchings
2018-12-09T22:06:54Z

From: Sagi Grimberg <sagig@mellanox.com>

commit a0b3b9b2409b409c677f7eb1e0485b816a5848f7 upstream.

In case login sequence failed, make sure conn->sess is
NULL before calling wait_conn as some transports (iser)
may rely on that (waiting for session commands).

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
drivers/target/iscsi/iscsi_target_login.c | 1 +
1 file changed, 1 insertion(+)

--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -1209,6 +1209,7 @@ void iscsi_target_login_sess_out(struct
}
kfree(conn->sess->sess_ops);
kfree(conn->sess);
+ conn->sess = NULL;

old_sess_out:
iscsi_stop_login_thread_timer(np);