All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: lpfc: prevent potential null pointer dereference
@ 2017-05-23 15:09 Gustavo A. R. Silva
  2017-05-29 23:06 ` James Smart
  2017-06-01  2:45 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2017-05-23 15:09 UTC (permalink / raw)
  To: James Smart, Dick Kennedy, James E.J. Bottomley, Martin K. Petersen
  Cc: linux-scsi, linux-kernel, Gustavo A. R. Silva

Null check at line 966: if (ndlp) {,  implies that ndlp might be NULL.
Functions lpfc_nlp_set_state() and lpfc_issue_els_prli() dereference
pointer ndlp. Include these function calls inside the IF block that
tests pointer ndlp.

Addresses-Coverity-ID: 1401856
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 drivers/scsi/lpfc/lpfc_ct.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index c7962da..ecb174b 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -978,9 +978,10 @@ lpfc_cmpl_ct_cmd_gft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
 					 ndlp, did, ndlp->nlp_fc4_type,
 					 FC_TYPE_FCP, FC_TYPE_NVME);
 			ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE;
+
+			lpfc_nlp_set_state(vport, ndlp, NLP_STE_PRLI_ISSUE);
+			lpfc_issue_els_prli(vport, ndlp, 0);
 		}
-		lpfc_nlp_set_state(vport, ndlp, NLP_STE_PRLI_ISSUE);
-		lpfc_issue_els_prli(vport, ndlp, 0);
 	} else
 		lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
 				 "3065 GFT_ID failed x%08x\n", irsp->ulpStatus);
-- 
2.5.0

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

* Re: [PATCH] scsi: lpfc: prevent potential null pointer dereference
  2017-05-23 15:09 [PATCH] scsi: lpfc: prevent potential null pointer dereference Gustavo A. R. Silva
@ 2017-05-29 23:06 ` James Smart
  2017-06-01  2:45 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: James Smart @ 2017-05-29 23:06 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Dick Kennedy, James E.J. Bottomley,
	Martin K. Petersen
  Cc: linux-scsi, linux-kernel

Looks good

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

-- james


On 5/23/2017 8:09 AM, Gustavo A. R. Silva wrote:
> Null check at line 966: if (ndlp) {,  implies that ndlp might be NULL.
> Functions lpfc_nlp_set_state() and lpfc_issue_els_prli() dereference
> pointer ndlp. Include these function calls inside the IF block that
> tests pointer ndlp.
>
> Addresses-Coverity-ID: 1401856
>

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

* Re: [PATCH] scsi: lpfc: prevent potential null pointer dereference
  2017-05-23 15:09 [PATCH] scsi: lpfc: prevent potential null pointer dereference Gustavo A. R. Silva
  2017-05-29 23:06 ` James Smart
@ 2017-06-01  2:45 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2017-06-01  2:45 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: James Smart, Dick Kennedy, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel


Gustavo A.,

> Null check at line 966: if (ndlp) {, implies that ndlp might be NULL.
> Functions lpfc_nlp_set_state() and lpfc_issue_els_prli() dereference
> pointer ndlp. Include these function calls inside the IF block that
> tests pointer ndlp.

Applied to 4.12/scsi-fixes. Thank you!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2017-06-01  2:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-23 15:09 [PATCH] scsi: lpfc: prevent potential null pointer dereference Gustavo A. R. Silva
2017-05-29 23:06 ` James Smart
2017-06-01  2:45 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.