Skip to contentSkip to conversation

scsi: lpfc: Check queue pointer before use

PATCH Applied Daniel Wagner 3 participants 3 messages Oct 18, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: lpfc: Check queue pointer before use

The queue pointer might not be valid. The rest of the code checks the pointer before accessing it. lpfc_sli4_process_missed_mbox_completions is the only place where the check is missing.

Fixes 657add4e5e15 ("scsi: lpfc: Fix poor use of hardware queues if fewer irq vectors")
Cc James Smart <[email protected]>

---
Hi,

Not entirely sure if this correct. I tried to understand the logic of the mentioned patch but failed to grasps all the details. Anyway, we observe a crash in lpfc_sli4_process_missed_mbox_completions() while iterating the array. All but the last one entry has a valid pointer.

Thanks,
Daniel

 drivers/scsi/lpfc/lpfc_sli.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_sli.c +1 -1
index 379c37451645..149966ba8a17 100644
@@ -7906,7 +7906,7 @@ lpfc_sli4_process_missed_mbox_completions(struct lpfc_hba *phba)
 	if (sli4_hba->hdwq) {
 		for (eqidx = 0; eqidx < phba->cfg_irq_chann; eqidx++) {
 			eq = phba->sli4_hba.hba_eq_hdl[eqidx].eq;
-			if (eq->queue_id == sli4_hba->mbx_cq->assoc_qid) {
+			if (eq && eq->queue_id == sli4_hba->mbx_cq->assoc_qid) {
 				fpeq = eq;
 				break;
 			}
Signature · 1 line
2.16.4
#1 lore raw
Quoted 26 lines · Daniel Wagner

The queue pointer might not be valid. The rest of the code checks the pointer before accessing it. lpfc_sli4_process_missed_mbox_completions is the only place where the check is missing.

Fixes 657add4e5e15 ("scsi: lpfc: Fix poor use of hardware queues if fewer irq vectors")
Cc James Smart <[email protected]>

---
Hi,

Not entirely sure if this correct. I tried to understand the logic of the mentioned patch but failed to grasps all the details. Anyway, we observe a crash in lpfc_sli4_process_missed_mbox_completions() while iterating the array. All but the last one entry has a valid pointer.

Thanks,
Daniel

  drivers/scsi/lpfc/lpfc_sli.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_sli.c +0 -0
index 379c37451645..149966ba8a17 100644

drivers/scsi/lpfc/lpfc_sli.c lpfc_sli4_process_missed_mbox_completions(struct lpfc_hba *phba) · line 7912

Quoted 8 lines
drivers/scsi/lpfc/lpfc_sli.c +1 -1
@@ -7906,7 +7906,7 @@ lpfc_sli4_process_missed_mbox_completions(struct lpfc_hba *phba)
  	if (sli4_hba->hdwq) {
  		for (eqidx = 0; eqidx < phba->cfg_irq_chann; eqidx++) {
  			eq = phba->sli4_hba.hba_eq_hdl[eqidx].eq;
-			if (eq->queue_id == sli4_hba->mbx_cq->assoc_qid) {
+			if (eq && eq->queue_id == sli4_hba->mbx_cq->assoc_qid) {
  				fpeq = eq;
  				break;
  			}

looks fine. Thanks!

Reviewed by: James Smart <[email protected]>

-- james

#2 lore raw
In reply to Daniel Wagner

Daniel,

Quoted 3 lines

The queue pointer might not be valid. The rest of the code checks the pointer before accessing it. lpfc_sli4_process_missed_mbox_completions is the only place where the check is missing.

Applied to 5.4/scsi-fixes, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering