[bug report] scsi: lpfc: Correct driver deregistrations with host nvme transport

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello James Smart,

This is a semi-automatic email about new static checker warnings.

The patch add9d6be3d65: "scsi: lpfc: Correct driver deregistrations
with host nvme transport" from Nov 20, 2017, leads to the following
Smatch complaint:

    drivers/scsi/lpfc/lpfc_nvme.c:969 lpfc_nvme_io_cmd_wqe_cmpl()
    error: we previously assumed 'ndlp' could be null (see line 938)

drivers/scsi/lpfc/lpfc_nvme.c
   937	
   938		if (ndlp && NLP_CHK_NODE_ACT(ndlp))
                    ^^^^
Existing code assumes ndlp can be NULL.

   939			atomic_dec(&ndlp->cmd_pending);
   940	
   941		/* Update stats and complete the IO.  There is
   942		 * no need for dma unprep because the nvme_transport
   943		 * owns the dma address.
   944		 */
   945	#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
   946		if (lpfc_ncmd->ts_cmd_start) {
   947			lpfc_ncmd->ts_isr_cmpl = pwqeIn->isr_timestamp;
   948			lpfc_ncmd->ts_data_nvme = ktime_get_ns();
   949			phba->ktime_last_cmd = lpfc_ncmd->ts_data_nvme;
   950			lpfc_nvme_ktime(phba, lpfc_ncmd);
   951		}
   952		if (phba->cpucheck_on & LPFC_CHECK_NVME_IO) {
   953			if (lpfc_ncmd->cpu != smp_processor_id())
   954				lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_IOERR,
   955						 "6701 CPU Check cmpl: "
   956						 "cpu %d expect %d\n",
   957						 smp_processor_id(), lpfc_ncmd->cpu);
   958			if (lpfc_ncmd->cpu < LPFC_CHECK_CPU_CNT)
   959				phba->cpucheck_cmpl_io[lpfc_ncmd->cpu]++;
   960		}
   961	#endif
   962		freqpriv = nCmd->private;
   963		freqpriv->nvme_buf = NULL;
   964	
   965		/* NVME targets need completion held off until the abort exchange
   966		 * completes unless the NVME Rport is getting unregistered.
   967		 */
   968		if (!(lpfc_ncmd->flags & LPFC_SBUF_XBUSY) ||
   969		    ndlp->upcall_flags & NLP_WAIT_FOR_UNREG) {
                    ^^^^^^^^^^^^^^^^^
The patch adds an unchecked dereference.

   970			/* Clear the XBUSY flag to prevent double completions.
   971			 * The nvme rport is getting unregistered and there is

regards,
dan carpenter



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux