]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iscsi-target: Fix panic when adding second TCP connection to iSCSI session
authorFeng Li <lifeng1519@gmail.com>
Mon, 11 Jul 2016 22:15:44 +0000 (06:15 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 20 Nov 2016 01:16:56 +0000 (01:16 +0000)
commit 8abc718de6e9e52d8a6bfdb735060554aeae25e4 upstream.

In MC/S scenario, the conn->sess has been set NULL in
iscsi_login_non_zero_tsih_s1 when the second connection comes here,
then kernel panic.

The conn->sess will be assigned in iscsi_login_non_zero_tsih_s2. So
we should check whether it's NULL before calling.

Signed-off-by: Feng Li <lifeng1519@gmail.com>
Tested-by: Sumit Rai <sumit.rai@calsoftinc.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

index 09dac9ac305eac396edd7967918e6c1e3270eb30..d534738ff3c7f9ecb07f05a59bb6188c7121b9f9 100644 (file)
@@ -1418,8 +1418,9 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
        }
        login->zero_tsih = zero_tsih;
 
-       conn->sess->se_sess->sup_prot_ops =
-               conn->conn_transport->iscsit_get_sup_prot_ops(conn);
+       if (conn->sess)
+               conn->sess->se_sess->sup_prot_ops =
+                       conn->conn_transport->iscsit_get_sup_prot_ops(conn);
 
        tpg = conn->tpg;
        if (!tpg) {