summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMike Christie <michael.christie@oracle.com>2021-05-25 13:18:06 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-20 16:16:08 +0200
commitbf20d85a88384574fabb3d53ad62a8af57e7ab11 (patch)
treeed727a953efcec99b5be952a51a0f844f4cfca17 /include
parent8d3f5e3b4ebe1e4cdc9f6d79dd24e77aa8007efb (diff)
downloadlinux-stable-bf20d85a88384574fabb3d53ad62a8af57e7ab11.tar.gz
linux-stable-bf20d85a88384574fabb3d53ad62a8af57e7ab11.tar.bz2
linux-stable-bf20d85a88384574fabb3d53ad62a8af57e7ab11.zip
scsi: iscsi: Fix conn use after free during resets
[ Upstream commit ec29d0ac29be366450a7faffbcf8cba3a6a3b506 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/scsi/libiscsi.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 1ee0f30ae190..647f1e0e726c 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -208,12 +208,6 @@ struct iscsi_conn {
unsigned long suspend_tx; /* suspend Tx */
unsigned long suspend_rx; /* suspend Rx */
- /* abort */
- wait_queue_head_t ehwait; /* used in eh_abort() */
- struct iscsi_tm tmhdr;
- struct timer_list tmf_timer;
- int tmf_state; /* see TMF_INITIAL, etc.*/
-
/* negotiated params */
unsigned max_recv_dlength; /* initiator_max_recv_dsl*/
unsigned max_xmit_dlength; /* target_max_recv_dsl */
@@ -283,6 +277,11 @@ struct iscsi_session {
* and recv lock.
*/
struct mutex eh_mutex;
+ /* abort */
+ wait_queue_head_t ehwait; /* used in eh_abort() */
+ struct iscsi_tm tmhdr;
+ struct timer_list tmf_timer;
+ int tmf_state; /* see TMF_INITIAL, etc.*/
/* iSCSI session-wide sequencing */
uint32_t cmdsn;