Skip to content

Commit b53b0d9

Browse files
author
Nicholas Bellinger
committed
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 <[email protected]> Cc: <[email protected]> # v3.1+ Signed-off-by: Nicholas Bellinger <[email protected]>
1 parent 1f0b030 commit b53b0d9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/target/iscsi/iscsi_target.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4540,6 +4540,7 @@ static void iscsit_logout_post_handler_diffcid(
45404540
{
45414541
struct iscsi_conn *l_conn;
45424542
struct iscsi_session *sess = conn->sess;
4543+
bool conn_found = false;
45434544

45444545
if (!sess)
45454546
return;
@@ -4548,12 +4549,13 @@ static void iscsit_logout_post_handler_diffcid(
45484549
list_for_each_entry(l_conn, &sess->sess_conn_list, conn_list) {
45494550
if (l_conn->cid == cid) {
45504551
iscsit_inc_conn_usage_count(l_conn);
4552+
conn_found = true;
45514553
break;
45524554
}
45534555
}
45544556
spin_unlock_bh(&sess->conn_lock);
45554557

4556-
if (!l_conn)
4558+
if (!conn_found)
45574559
return;
45584560

45594561
if (l_conn->sock)

0 commit comments

Comments
 (0)