]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: iscsi: Fix conn use after free during resets
authorMike Christie <michael.christie@oracle.com>
Tue, 25 May 2021 18:18:06 +0000 (13:18 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 2 Jun 2021 05:28:21 +0000 (01:28 -0400)
commitbd3d031216c2afe2265c8c2f902cb5c449b4b713
tree7b363b26e9e235c989aac6751f5c691009d458bc
parenta3b7d8c9b6814e86a4cca573a670facea74393cc
scsi: iscsi: Fix conn use after free during resets

If we haven't done a unbind target call we can race where
iscsi_conn_teardown wakes up the EH thread and then frees the conn while
those threads are still accessing the conn ehwait.

We can only do one TMF per session so this just moves the TMF fields from
the conn to the session. We can then rely on the
iscsi_session_teardown->iscsi_remove_session->__iscsi_unbind_session call
to remove the target and it's devices, and know after that point there is
no device or scsi-ml callout trying to access the session.

Link: https://lore.kernel.org/r/20210525181821.7617-14-michael.christie@oracle.com
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/libiscsi.c
include/scsi/libiscsi.h