Skip to contentSkip to conversation

lpfc: Fix null ndlp derefernce in target_reset_handler

PATCH In review James Smart 1 participant 1 message Feb 5, 2015

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

PATCH 12/21 lpfc: Fix null ndlp derefernce in target_reset_handler

---
 drivers/scsi/lpfc/lpfc_scsi.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/scsi/lpfc/lpfc_scsi.c +6 -4
index f623299..5612ba6 100644
@@ -5202,10 +5202,12 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd)
 	if (status == FAILED) {
 		lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
 			"0722 Target Reset rport failure: rdata x%p\n", rdata);
-		spin_lock_irq(shost->host_lock);
-		pnode->nlp_flag &= ~NLP_NPR_ADISC;
-		pnode->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
-		spin_unlock_irq(shost->host_lock);
+		if (pnode) {
+			spin_lock_irq(shost->host_lock);
+			pnode->nlp_flag &= ~NLP_NPR_ADISC;
+			pnode->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
+			spin_unlock_irq(shost->host_lock);
+		}
 		lpfc_reset_flush_io_context(vport, tgt_id, lun_id,
 					  LPFC_CTX_TGT);
 		return FAST_IO_FAIL;
Signature · 4 lines
1.7.11.7

Signed-off-by: James Smart <[email protected]>
Signed-off-by: Dick Kennedy <[email protected]>