linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: lpfc: Check queue pointer before use
@ 2019-10-18 16:21 Daniel Wagner
  2019-10-18 21:40 ` James Smart
  2019-10-18 22:00 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Wagner @ 2019-10-18 16:21 UTC (permalink / raw)
  To: linux-scsi; +Cc: linux-kernel, Dick Kennedy, Daniel Wagner, James Smart

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 <jsmart2021@gmail.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
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(-)

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 379c37451645..149966ba8a17 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -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;
 			}
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: lpfc: Check queue pointer before use
  2019-10-18 16:21 [PATCH] scsi: lpfc: Check queue pointer before use Daniel Wagner
@ 2019-10-18 21:40 ` James Smart
  2019-10-18 22:00 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: James Smart @ 2019-10-18 21:40 UTC (permalink / raw)
  To: Daniel Wagner, linux-scsi; +Cc: linux-kernel, Dick Kennedy, James Smart

On 10/18/2019 9:21 AM, Daniel Wagner wrote:
> 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 <jsmart2021@gmail.com>
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
> 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(-)
>
> diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
> index 379c37451645..149966ba8a17 100644
> --- a/drivers/scsi/lpfc/lpfc_sli.c
> +++ b/drivers/scsi/lpfc/lpfc_sli.c
> @@ -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 <james.smart@broadcom.com>

-- james


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: lpfc: Check queue pointer before use
  2019-10-18 16:21 [PATCH] scsi: lpfc: Check queue pointer before use Daniel Wagner
  2019-10-18 21:40 ` James Smart
@ 2019-10-18 22:00 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2019-10-18 22:00 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: linux-scsi, linux-kernel, Dick Kennedy, James Smart


Daniel,

> 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!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-18 22:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-18 16:21 [PATCH] scsi: lpfc: Check queue pointer before use Daniel Wagner
2019-10-18 21:40 ` James Smart
2019-10-18 22:00 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).