Re: [PATCH 1/2] lpfc: call lpfc_sli_validate_fcp_iocb() with the hbalock held

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The check is better and is fine to accept. However, in reviewing the code, there may still be some raciness as some of the fields validated aren't set under lock. We'll look deeper. Regardless, holding the lock while counting is a very good thing to do.

Signed-off-by: James Smart <james.smart@xxxxxxxxxxxx>

-- james


On 7/18/2016 7:06 AM, Johannes Thumshirn wrote:
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@xxxxxxx>
---
  drivers/scsi/lpfc/lpfc_sli.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 1a248a2..d58ec4c 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -9978,6 +9978,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];
@@ -9985,6 +9986,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;
  }

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux