Blob Blame History Raw
From: James Smart <jsmart2021@gmail.com>
Date: Mon, 11 Nov 2019 15:03:56 -0800
Subject: scsi: lpfc: fix: Coverity: lpfc_get_scsi_buf_s3(): Null pointer
 dereferences
Patch-mainline: v5.5-rc1
Git-commit: 6f23f8c5c9f1be4eb17c035129c80e49000c18a7
References: bsc#1154601

Coverity reported the following:

Acked-by: Daniel Wagner <dwagner@suse.de>
---
 drivers/scsi/lpfc/lpfc_scsi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -609,7 +609,7 @@ lpfc_get_scsi_buf_s3(struct lpfc_hba *ph
 	}
 	spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, iflag);
 
-	if (lpfc_ndlp_check_qdepth(phba, ndlp)) {
+	if (lpfc_ndlp_check_qdepth(phba, ndlp) && lpfc_cmd) {
 		atomic_inc(&ndlp->cmd_pending);
 		lpfc_cmd->flags |= LPFC_SBUF_BUMP_QDEPTH;
 	}