Commit e018f03d authored by Ding Hui's avatar Ding Hui Committed by Martin K. Petersen

scsi: libiscsi: Move ehwait initialization to iscsi_session_setup()

Commit ec29d0ac ("scsi: iscsi: Fix conn use after free during resets")
moved member ehwait from 'conn' to 'session', but left the initialization
of ehwait in iscsi_conn_setup().

Although a session can only have 1 conn currently, it is better to
initialize ehwait in iscsi_session_setup() in case we implement handling
multiple conns in the future.

Link: https://lore.kernel.org/r/20210911135159.20543-1-dinghui@sangfor.com.cnReviewed-by: default avatarMike Christie <michael.christie@oracle.com>
Signed-off-by: default avatarDing Hui <dinghui@sangfor.com.cn>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent ce4fc333
...@@ -2947,6 +2947,7 @@ iscsi_session_setup(struct iscsi_transport *iscsit, struct Scsi_Host *shost, ...@@ -2947,6 +2947,7 @@ iscsi_session_setup(struct iscsi_transport *iscsit, struct Scsi_Host *shost,
session->tmf_state = TMF_INITIAL; session->tmf_state = TMF_INITIAL;
timer_setup(&session->tmf_timer, iscsi_tmf_timedout, 0); timer_setup(&session->tmf_timer, iscsi_tmf_timedout, 0);
mutex_init(&session->eh_mutex); mutex_init(&session->eh_mutex);
init_waitqueue_head(&session->ehwait);
spin_lock_init(&session->frwd_lock); spin_lock_init(&session->frwd_lock);
spin_lock_init(&session->back_lock); spin_lock_init(&session->back_lock);
...@@ -3074,8 +3075,6 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, ...@@ -3074,8 +3075,6 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size,
goto login_task_data_alloc_fail; goto login_task_data_alloc_fail;
conn->login_task->data = conn->data = data; conn->login_task->data = conn->data = data;
init_waitqueue_head(&session->ehwait);
return cls_conn; return cls_conn;
login_task_data_alloc_fail: login_task_data_alloc_fail:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment