public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Smart <jsmart2021@gmail.com>
To: linux-scsi@vger.kernel.org, linux-nvme@lists.infradead.org
Cc: James Smart <jsmart2021@gmail.com>,
	Dick Kennedy <dick.kennedy@broadcom.com>,
	James Smart <james.smart@broadcom.com>
Subject: [PATCH 02/15] lpfc: Fix system crash when port is reset.
Date: Wed, 10 May 2017 12:07:00 -0700	[thread overview]
Message-ID: <20170510190713.30171-3-jsmart2021@gmail.com> (raw)
In-Reply-To: <20170510190713.30171-1-jsmart2021@gmail.com>

The driver panic when using the els_wq during port reset.

Check for NULL els_wq before dereferencing.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
---
 drivers/scsi/lpfc/lpfc.h         | 8 ++++++--
 drivers/scsi/lpfc/lpfc_hbadisc.c | 6 +++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 6d7840b096e6..62571fa9c6ad 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -1228,7 +1228,11 @@ lpfc_sli_read_hs(struct lpfc_hba *phba)
 static inline struct lpfc_sli_ring *
 lpfc_phba_elsring(struct lpfc_hba *phba)
 {
-	if (phba->sli_rev == LPFC_SLI_REV4)
-		return phba->sli4_hba.els_wq->pring;
+	if (phba->sli_rev == LPFC_SLI_REV4) {
+		if (phba->sli4_hba.els_wq)
+			return phba->sli4_hba.els_wq->pring;
+		else
+			return NULL;
+	}
 	return &phba->sli.sli3_ring[LPFC_ELS_RING];
 }
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 0482c5580331..dcc9b3858778 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -693,9 +693,9 @@ lpfc_work_done(struct lpfc_hba *phba)
 	pring = lpfc_phba_elsring(phba);
 	status = (ha_copy & (HA_RXMASK  << (4*LPFC_ELS_RING)));
 	status >>= (4*LPFC_ELS_RING);
-	if ((status & HA_RXMASK) ||
-	    (pring->flag & LPFC_DEFERRED_RING_EVENT) ||
-	    (phba->hba_flag & HBA_SP_QUEUE_EVT)) {
+	if (pring && (status & HA_RXMASK ||
+		      pring->flag & LPFC_DEFERRED_RING_EVENT ||
+		      phba->hba_flag & HBA_SP_QUEUE_EVT)) {
 		if (pring->flag & LPFC_STOP_IOCB_EVENT) {
 			pring->flag |= LPFC_DEFERRED_RING_EVENT;
 			/* Set the lpfc data pending flag */
-- 
2.11.0

  parent reply	other threads:[~2017-05-10 19:07 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-10 19:06 [PATCH 00/15] lpfc updates for 11.2.0.14 James Smart
2017-05-10 19:06 ` [PATCH 01/15] lpfc: Fix used-RPI accounting problem James Smart
2017-05-11  6:04   ` Hannes Reinecke
2017-05-10 19:07 ` James Smart [this message]
2017-05-11  6:05   ` [PATCH 02/15] lpfc: Fix system crash when port is reset Hannes Reinecke
2017-05-15 19:31   ` Guilherme G. Piccoli
2017-05-10 19:07 ` [PATCH 03/15] lpfc: Adding additional stats counters for nvme James Smart
2017-05-11  6:06   ` Hannes Reinecke
2017-05-10 19:07 ` [PATCH 04/15] lpfc: Fix nvmet RQ resource needs for large block writes James Smart
2017-05-11  6:18   ` Hannes Reinecke
2017-05-15 21:48     ` James Smart
2017-05-10 19:07 ` [PATCH 05/15] lpfc: Fix NVMEI driver not decrementing counter causing bad rport state James Smart
2017-05-11  6:18   ` Hannes Reinecke
2017-05-10 19:07 ` [PATCH 06/15] lpfc: Fix NMI watchdog assertions when running nvmet IOPS tests James Smart
2017-05-11  6:21   ` Hannes Reinecke
2017-05-10 19:07 ` [PATCH 07/15] lpfc: Separate NVMET data buffer pool fir ELS/CT James Smart
2017-05-11  6:22   ` Hannes Reinecke
2017-05-10 19:07 ` [PATCH 08/15] lpfc: Separate NVMET RQ buffer posting from IO resources SGL/iocbq/context James Smart
2017-05-11  7:23   ` Hannes Reinecke
2017-05-10 19:07 ` [PATCH 09/15] lpfc: Added recovery logic for running out of NVMET IO context resources James Smart
2017-05-11  7:24   ` Hannes Reinecke
2017-05-10 19:07 ` [PATCH 10/15] lpfc: Fix NVME I+T not registering NVME as a supported FC4 type James Smart
2017-05-11  7:35   ` Hannes Reinecke
2017-05-15 21:57     ` James Smart
2017-05-10 19:07 ` [PATCH 11/15] lpfc: Fix debugfs root inode "lpfc" not getting deleted on driver unload James Smart
2017-05-11  7:45   ` Hannes Reinecke
2017-05-10 19:07 ` [PATCH 12/15] lpfc: Cleanup entry_repost settings on SLI4 queues James Smart
2017-05-11  7:49   ` Hannes Reinecke
2017-05-15 22:13     ` James Smart
2017-05-10 19:07 ` [PATCH 13/15] lpfc: Fix NVMEI's handling of NVMET's PRLI response attributes James Smart
2017-05-11  7:50   ` Hannes Reinecke
2017-05-10 19:07 ` [PATCH 14/15] lpfc: Add MDS Diagnostic support James Smart
2017-05-11  7:51   ` Hannes Reinecke
2017-05-10 19:07 ` [PATCH 15/15] lpfc: update version to 11.2.0.14 James Smart
2017-05-11  7:51   ` Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170510190713.30171-3-jsmart2021@gmail.com \
    --to=jsmart2021@gmail.com \
    --cc=dick.kennedy@broadcom.com \
    --cc=james.smart@broadcom.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox