[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250715073926.3529456-1-lilingfeng3@huawei.com>
Date: Tue, 15 Jul 2025 15:39:26 +0800
From: Li Lingfeng <lilingfeng3@...wei.com>
To: <lduncan@...e.com>, <cleech@...hat.com>, <njavali@...vell.com>,
<mrangankar@...vell.com>, <GR-QLogic-Storage-Upstream@...vell.com>,
<martin.petersen@...cle.com>, <jejb@...ux.ibm.com>,
<James.Bottomley@...senPartnership.com>, <michael.christie@...cle.com>
CC: <open-iscsi@...glegroups.com>, <linux-scsi@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <yukuai1@...weicloud.com>,
<houtao1@...wei.com>, <yi.zhang@...wei.com>, <yangerkun@...wei.com>,
<chengzhihao1@...wei.com>, <lilingfeng@...weicloud.com>,
<lilingfeng3@...wei.com>
Subject: [PATCH] Revert "scsi: iscsi: Fix HW conn removal use after free"
This reverts commit c577ab7ba5f3bf9062db8a58b6e89d4fe370447e.
The invocation of iscsi_put_conn() in iscsi_iter_destory_conn_fn() is used
to free the initial reference counter of iscsi_cls_conn.
For non-qla4xxx cases, the ->destroy_conn() callback (e.g.,
iscsi_conn_teardown) will call iscsi_remove_conn() and iscsi_put_conn() to
remove the connection from the children list of session and free the
connection at last.
However for qla4xxx, it is not the case. The ->destroy_conn() callback
of qla4xxx will keep the connection in the session conn_list and doesn't
use iscsi_put_conn() to free the initial reference counter. Therefore,
it seems necessary to keep the iscsi_put_conn() in the
iscsi_iter_destroy_conn_fn(), otherwise, there will be memory leak
problem.
Link: https://lore.kernel.org/all/88334658-072b-4b90-a949-9c74ef93cfd1@huawei.com/
Fixes: c577ab7ba5f3 ("scsi: iscsi: Fix HW conn removal use after free")
Signed-off-by: Li Lingfeng <lilingfeng3@...wei.com>
---
drivers/scsi/scsi_transport_iscsi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index c75a806496d6..743b4c792ceb 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -2143,6 +2143,8 @@ static int iscsi_iter_destroy_conn_fn(struct device *dev, void *data)
return 0;
iscsi_remove_conn(iscsi_dev_to_conn(dev));
+ iscsi_put_conn(iscsi_dev_to_conn(dev));
+
return 0;
}
--
2.46.1
Powered by blists - more mailing lists