Re: [PATCH AUTOSEL 5.10 07/22] scsi: iscsi: Fix race condition between login and sync thread

Mike Christie
2021-04-06T17:24:43Z

On 4/5/21 11:04 AM, Sasha Levin wrote:
> From: Gulam Mohamed <gulam.mohamed@oracle.com>
>
> [ Upstream commit 9e67600ed6b8565da4b85698ec659b5879a6c1c6 ]
>
> A kernel panic was observed due to a timing issue between the sync thread
> and the initiator processing a login response from the target. The session
> reopen can be invoked both from the session sync thread when iscsid
> restarts and from iscsid through the error handler. Before the initiator
> receives the response to a login, another reopen request can be sent from
> the error handler/sync session. When the initial login response is
> subsequently processed, the connection has been closed and the socket has
> been released.
>
> To fix this a new connection state, ISCSI_CONN_BOUND, is added:
>
> - Set the connection state value to ISCSI_CONN_DOWN upon
> iscsi_if_ep_disconnect() and iscsi_if_stop_conn()
>
> - Set the connection state to the newly created value ISCSI_CONN_BOUND
> after bind connection (transport->bind_conn())
>
> - In iscsi_set_param(), return -ENOTCONN if the connection state is not
> either ISCSI_CONN_BOUND or ISCSI_CONN_UP
>
> Link: https://urldefense.com/v3/__https://lore.kernel.org/r/20210325093248.284678-1-gulam.mohamed@oracle.com__;!!GqivPVa7Brio!Jiqrc6pu3EgrquzpG-KpNQkNebwKUgctkE0MN1MloQ2y5Y4OVOkKN0yCr2_W_CX2oRet$
> Reviewed-by: Mike Christie <michael.christie@oracle.com>

There was a mistake in my review of this patch. It will also require
this "[PATCH 1/1] scsi: iscsi: fix iscsi cls conn state":