scsi: scsi_debug: Fix in_use bitmap corruption
authorDouglas Gilbert <dgilbert@interlog.com>
Thu, 2 Jul 2020 14:53:55 +0000 (10:53 -0400)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 3 Jul 2020 03:49:54 +0000 (23:49 -0400)
commit74595c044cb56cb073370c09fefc23eb8ed6d835
tree093a812cdbb969fed4f9aa8f2753fcb0af2394a4
parent93bf02e5a2c2418bc290a778cd537837d789d9ee
scsi: scsi_debug: Fix in_use bitmap corruption

Heavy testing indicates the irqsave() spinlock around the __set_bit() is
insufficient to stop following clear_bit() calls being rarely applied
out-of-order. Also the nearby failed kzalloc() path leading to
SCSI_MLQUEUE_HOST_BUSY does not properly undo the in_use bitmap and
num_in_q, fix.

Link: https://lore.kernel.org/r/20200702145355.522283-1-dgilbert@interlog.com
Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_debug.c