diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-08-18 15:07:44 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-09-07 22:09:59 -0700 |
commit | 258d670469ce3b3e8d465c8a503406181e7bede0 (patch) | |
tree | b8faff50c7d1e55f36a11d96f7a6dcfc759223ef | |
parent | ce799c71c8c08ad500f4ad56c3bac2c8ac435d9f (diff) | |
download | linux-stable-258d670469ce3b3e8d465c8a503406181e7bede0.tar.gz linux-stable-258d670469ce3b3e8d465c8a503406181e7bede0.tar.bz2 linux-stable-258d670469ce3b3e8d465c8a503406181e7bede0.zip |
iscsi-target: Fix iscsit_transport reference leak during NP thread reset
commit c9a03c12464c851e691e8d5b6c9deba779c512e0 upstream.
This patch fixes a bug in __iscsi_target_login_thread() where an explicit
network portal thread reset ends up leaking the iscsit_transport module
reference, along with the associated iscsi_conn allocation.
This manifests itself with iser-target where a NP reset causes the extra
iscsit_transport reference to be taken in iscsit_conn_set_transport()
during the reset, which prevents the ib_isert module from being unloaded
after the NP thread shutdown has finished.
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/target/iscsi/iscsi_target_login.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index 3402241be87c..bc788c52b6cc 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c @@ -1163,12 +1163,11 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) if (np->np_thread_state == ISCSI_NP_THREAD_RESET) { spin_unlock_bh(&np->np_thread_lock); complete(&np->np_restart_comp); - if (ret == -ENODEV) { - iscsit_put_transport(conn->conn_transport); - kfree(conn); - conn = NULL; + iscsit_put_transport(conn->conn_transport); + kfree(conn); + conn = NULL; + if (ret == -ENODEV) goto out; - } /* Get another socket */ return 1; } |