]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: ibmvfc: Fix potential race in ibmvfc_wait_for_ops()
authorTyrel Datwyler <tyreld@linux.ibm.com>
Fri, 19 Mar 2021 20:50:28 +0000 (14:50 -0600)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 25 Mar 2021 01:42:30 +0000 (21:42 -0400)
commitc94c3c08de0a225df5ddf28665202ac014453c1f
tree3020a23ef06c4d708fd2dd9cf90e92f097877853
parent3a457acddf51c4a9420c1b1b4d3a3877e43c0c03
scsi: ibmvfc: Fix potential race in ibmvfc_wait_for_ops()

For various EH activities the ibmvfc driver uses ibmvfc_wait_for_ops() to
wait for the completion of commands that match a given criteria be it
cancel key, or specific LUN. With recent changes commands are completed
outside the lock in bulk by removing them from the sent list and adding
them to a private completion list. This introduces a potential race in
ibmvfc_wait_for_ops() since the criteria for a command to be outstanding is
no longer simply being on the sent list, but instead not being on the free
list.

Avoid this race by scanning the entire command event pool and checking that
any matching command that ibmvfc needs to wait on is not already on the
free list.

Link: https://lore.kernel.org/r/20210319205029.312969-2-tyreld@linux.ibm.com
Fixes: 3d82b3a71288 ("scsi: ibmvfc: Complete commands outside the host/queue lock")
Reviewed-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ibmvscsi/ibmvfc.c