]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
scsi: iscsi: Fix unbound endpoint error handling
authorMike Christie <michael.christie@oracle.com>
Fri, 8 Apr 2022 00:13:10 +0000 (19:13 -0500)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 27 Apr 2022 10:00:49 +0000 (12:00 +0200)
commit97ae74d34f9e547e3733a35a992821d89a23af3b
tree29b683b0c32817ea8dd65634d4e59910b2ecb61f
parent93cbe324e50544f98cd08814b42f38c16561d420
scsi: iscsi: Fix unbound endpoint error handling

BugLink: https://bugs.launchpad.net/bugs/1969857
[ Upstream commit 03690d81974535f228e892a14f0d2d44404fe555 ]

If a driver raises a connection error before the connection is bound, we
can leave a cleanup_work queued that can later run and disconnect/stop a
connection that is logged in. The problem is that drivers can call
iscsi_conn_error_event for endpoints that are connected but not yet bound
when something like the network port they are using is brought down.
iscsi_cleanup_conn_work_fn will check for this and exit early, but if the
cleanup_work is stuck behind other works, it might not get run until after
userspace has done ep_disconnect. Because the endpoint is not yet bound
there was no way for ep_disconnect to flush the work.

The bug of leaving stop_conns queued was added in:

Commit 23d6fefbb3f6 ("scsi: iscsi: Fix in-kernel conn failure handling")

and:

Commit 0ab710458da1 ("scsi: iscsi: Perform connection failure entirely in
kernel space")

was supposed to fix it, but left this case.

This patch moves the conn state check to before we even queue the work so
we can avoid queueing.

Link: https://lore.kernel.org/r/20220408001314.5014-7-michael.christie@oracle.com
Fixes: 0ab710458da1 ("scsi: iscsi: Perform connection failure entirely in kernel space")
Tested-by: Manish Rangankar <mrangankar@marvell.com>
Reviewed-by: Lee Duncan <lduncan@@suse.com>
Reviewed-by: Chris Leech <cleech@redhat.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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/scsi/scsi_transport_iscsi.c