lpfc: call lpfc_sli_validate_fcp_iocb() with the hbalock held
authorJohannes Thumshirn <jthumshirn@suse.de>
Mon, 18 Jul 2016 14:06:03 +0000 (16:06 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 20 Jul 2016 23:45:35 +0000 (19:45 -0400)
Call lpfc_sli_validate_fcp_iocb() with the hbalock held, as the pointer
to iocbq is not guaranteed to still be valid after looking it up.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Acked-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_sli.c

index c8fd0a349eba6985c8fc54ece3f815d0e6d039c3..351d08ace24a31a2a447ae0e02f095b6aeefd8d6 100644 (file)
@@ -10203,6 +10203,7 @@ lpfc_sli_sum_iocb(struct lpfc_vport *vport, uint16_t tgt_id, uint64_t lun_id,
        struct lpfc_iocbq *iocbq;
        int sum, i;
 
+       spin_lock_irq(&phba->hbalock);
        for (i = 1, sum = 0; i <= phba->sli.last_iotag; i++) {
                iocbq = phba->sli.iocbq_lookup[i];
 
@@ -10210,6 +10211,7 @@ lpfc_sli_sum_iocb(struct lpfc_vport *vport, uint16_t tgt_id, uint64_t lun_id,
                                                ctx_cmd) == 0)
                        sum++;
        }
+       spin_unlock_irq(&phba->hbalock);
 
        return sum;
 }