]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
scsi: qla2xxx: Wait for io return on terminate rport
authorQuinn Tran <qutran@marvell.com>
Fri, 28 Apr 2023 07:53:38 +0000 (00:53 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Aug 2023 09:33:46 +0000 (11:33 +0200)
commit8a55556cd7e0220486163b1285ce11a8be2ce5fa
tree867556faaa890c229d77215fa9e5f136bc03bb98
parent79453641fced880edbf6e979778c416c89d1ef23
scsi: qla2xxx: Wait for io return on terminate rport

commit fc0cba0c7be8261a1625098bd1d695077ec621c9 upstream.

System crash due to use after free.
Current code allows terminate_rport_io to exit before making
sure all IOs has returned. For FCP-2 device, IO's can hang
on in HW because driver has not tear down the session in FW at
first sign of cable pull. When dev_loss_tmo timer pops,
terminate_rport_io is called and upper layer is about to
free various resources. Terminate_rport_io trigger qla to do
the final cleanup, but the cleanup might not be fast enough where it
leave qla still holding on to the same resource.

Wait for IO's to return to upper layer before resources are freed.

Cc: stable@vger.kernel.org
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Link: https://lore.kernel.org/r/20230428075339.32551-7-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/qla2xxx/qla_attr.c