OSDN Git Service

scsi: hisi_sas: Fix spin lock management in slot_index_alloc_quirk_v2_hw()
authorJohn Garry <john.garry@huawei.com>
Tue, 16 Oct 2018 15:00:36 +0000 (23:00 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 16 Oct 2018 21:50:49 +0000 (17:50 -0400)
Currently a spin_unlock_irqrestore() call is missing on the error path,
so add it.

Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c

index 70d6b28..cc36b64 100644 (file)
@@ -806,8 +806,10 @@ slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba,
        while (1) {
                start = find_next_zero_bit(bitmap,
                                        hisi_hba->slot_index_count, start);
-               if (start >= end)
+               if (start >= end) {
+                       spin_unlock_irqrestore(&hisi_hba->lock, flags);
                        return -SAS_QUEUE_FULL;
+               }
                /*
                  * SAS IPTT bit0 should be 1, and SATA IPTT bit0 should be 0.
                  */