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)
committerJiri Slaby <jslaby@suse.cz>
Mon, 11 Jan 2016 15:07:24 +0000 (16:07 +0100)
commit 63e480fd2f598e9ad37f89e79c36834e7dd60ba0 upstream.

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>
Acked-by: Johannes Thumshirn <jthumshirn@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/scsi/lpfc/lpfc_scsi.c

index ed7759980c47991366a5135a7e4725bf56d13a10..1d01ed6f8dd27dcd3fb51dafbc1168d1ff26586c 100644 (file)
@@ -5264,7 +5264,15 @@ 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);
-               return FAILED;
+               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;
        }
 
        scsi_event.event_type = FC_REG_SCSI_EVENT;