Skip to content

Commit

Permalink
iscsi-target: Fix memory corruption in iscsit_logout_post_handler_dif…
Browse files Browse the repository at this point in the history
…fcid

This patch fixes a bug in iscsit_logout_post_handler_diffcid() where
a pointer used as storage for list_for_each_entry() was incorrectly
being used to determine if no matching entry had been found.

This patch changes iscsit_logout_post_handler_diffcid() to key off
bool conn_found to determine if the function needs to exit early.

Reported-by: Joern Engel <joern@logfs.org>
Cc: <stable@vger.kernel.org> # v3.1+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
  • Loading branch information
Nicholas Bellinger committed Sep 17, 2014
1 parent 1f0b030 commit b53b0d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/target/iscsi/iscsi_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -4540,6 +4540,7 @@ static void iscsit_logout_post_handler_diffcid(
{
struct iscsi_conn *l_conn;
struct iscsi_session *sess = conn->sess;
bool conn_found = false;

if (!sess)
return;
Expand All @@ -4548,12 +4549,13 @@ static void iscsit_logout_post_handler_diffcid(
list_for_each_entry(l_conn, &sess->sess_conn_list, conn_list) {
if (l_conn->cid == cid) {
iscsit_inc_conn_usage_count(l_conn);
conn_found = true;
break;
}
}
spin_unlock_bh(&sess->conn_lock);

if (!l_conn)
if (!conn_found)
return;

if (l_conn->sock)
Expand Down

0 comments on commit b53b0d9

Please sign in to comment.