lpfc: Fix null ndlp dereference in target_reset_handler
authorJames Smart <james.smart@emulex.com>
Tue, 7 Apr 2015 19:07:20 +0000 (15:07 -0400)
committerJames Bottomley <JBottomley@Odin.com>
Fri, 10 Apr 2015 14:49:10 +0000 (07:49 -0700)
Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
drivers/scsi/lpfc/lpfc_scsi.c

index f6232991fb37ed5af4677354f552a2233c365a75..5612ba6bf213d7ef325491a0664817182cc04cc9 100644 (file)
@@ -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;