scsi: qla2xxx: Fix deletion race condition
authorQuinn Tran <qutran@marvell.com>
Fri, 14 Jul 2023 07:00:55 +0000 (12:30 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sun, 23 Jul 2023 20:27:46 +0000 (16:27 -0400)
commit6dfe4344c168c6ca20fe7640649aacfcefcccb26
tree39d341d85a84bbe882fa31284234950aac5f64c7
parent06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5
scsi: qla2xxx: Fix deletion race condition

System crash when using debug kernel due to link list corruption. The cause
of the link list corruption is due to session deletion was allowed to queue
up twice.  Here's the internal trace that show the same port was allowed to
double queue for deletion on different cpu.

20808683956 015 qla2xxx [0000:13:00.1]-e801:4: Scheduling sess ffff93ebf9306800 for deletion 50:06:0e:80:12:48:ff:50 fc4_type 1
20808683957 027 qla2xxx [0000:13:00.1]-e801:4: Scheduling sess ffff93ebf9306800 for deletion 50:06:0e:80:12:48:ff:50 fc4_type 1

Move the clearing/setting of deleted flag lock.

Cc: stable@vger.kernel.org
Fixes: 726b85487067 ("qla2xxx: Add framework for async fabric discovery")
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Link: https://lore.kernel.org/r/20230714070104.40052-2-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_target.c