Skip to content

Commit

Permalink
iscsi-target: Fix iscsit_transport reference leak during NP thread reset
Browse files Browse the repository at this point in the history
commit c9a03c1 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>
  • Loading branch information
Nicholas Bellinger authored and Greg Kroah-Hartman committed Sep 8, 2013
1 parent ce799c7 commit 258d670
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/target/iscsi/iscsi_target_login.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 258d670

Please sign in to comment.