aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2014-09-17 14:45:17 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2014-09-17 16:40:19 -0400
commitb53b0d99d6fbf7d44330395349a895521cfdbc96 (patch)
tree46c4a42cf72b8e2c0d5a1bb615fcd9c273e31726 /drivers/target
parent1f0b030c45c781f9fe568e5e2a813d6c8567a051 (diff)
iscsi-target: Fix memory corruption in iscsit_logout_post_handler_diffcid
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>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/iscsi/iscsi_target.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 1f4c794f5fcc..260c3e1e312c 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -4540,6 +4540,7 @@ static void iscsit_logout_post_handler_diffcid(
4540{ 4540{
4541 struct iscsi_conn *l_conn; 4541 struct iscsi_conn *l_conn;
4542 struct iscsi_session *sess = conn->sess; 4542 struct iscsi_session *sess = conn->sess;
4543 bool conn_found = false;
4543 4544
4544 if (!sess) 4545 if (!sess)
4545 return; 4546 return;
@@ -4548,12 +4549,13 @@ static void iscsit_logout_post_handler_diffcid(
4548 list_for_each_entry(l_conn, &sess->sess_conn_list, conn_list) { 4549 list_for_each_entry(l_conn, &sess->sess_conn_list, conn_list) {
4549 if (l_conn->cid == cid) { 4550 if (l_conn->cid == cid) {
4550 iscsit_inc_conn_usage_count(l_conn); 4551 iscsit_inc_conn_usage_count(l_conn);
4552 conn_found = true;
4551 break; 4553 break;
4552 } 4554 }
4553 } 4555 }
4554 spin_unlock_bh(&sess->conn_lock); 4556 spin_unlock_bh(&sess->conn_lock);
4555 4557
4556 if (!l_conn) 4558 if (!conn_found)
4557 return; 4559 return;
4558 4560
4559 if (l_conn->sock) 4561 if (l_conn->sock)