Skip to content

Commit 7bdc689

Browse files
Li Lingfengmartinkpetersen
authored andcommitted
scsi: Revert "scsi: iscsi: Fix HW conn removal use after free"
This reverts commit c577ab7. 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/[email protected]/ Fixes: c577ab7 ("scsi: iscsi: Fix HW conn removal use after free") Signed-off-by: Li Lingfeng <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Mike Christie <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent dafeaf2 commit 7bdc689

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/scsi/scsi_transport_iscsi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,6 +2143,8 @@ static int iscsi_iter_destroy_conn_fn(struct device *dev, void *data)
21432143
return 0;
21442144

21452145
iscsi_remove_conn(iscsi_dev_to_conn(dev));
2146+
iscsi_put_conn(iscsi_dev_to_conn(dev));
2147+
21462148
return 0;
21472149
}
21482150

0 commit comments

Comments
 (0)