linux/drivers/scsi/lpfc
James Smart 6f23f8c5c9 scsi: lpfc: fix: Coverity: lpfc_get_scsi_buf_s3(): Null pointer dereferences
Coverity reported the following:

*** CID 1487391:  Null pointer dereferences  (FORWARD_NULL)
/drivers/scsi/lpfc/lpfc_scsi.c: 614 in lpfc_get_scsi_buf_s3()
608     		spin_unlock(&phba->scsi_buf_list_put_lock);
609     	}
610     	spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, iflag);
611
612     	if (lpfc_ndlp_check_qdepth(phba, ndlp)) {
613     		atomic_inc(&ndlp->cmd_pending);
vvv     CID 1487391:  Null pointer dereferences  (FORWARD_NULL)
vvv     Dereferencing null pointer "lpfc_cmd".
614     		lpfc_cmd->flags |= LPFC_SBUF_BUMP_QDEPTH;
615     	}
616     	return  lpfc_cmd;
617     }
618     /**
619      * lpfc_get_scsi_buf_s4 - Get a scsi buffer from io_buf_list of the HBA

Fix by checking lpfc_cmd to be non-NULL as part of line 612

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1487391 ("Null pointer dereferences")
Fixes: 2a5b7d626e ("scsi: lpfc: Limit tracking of tgt queue depth in fast path")

CC: "Martin K. Petersen" <martin.petersen@oracle.com>
CC: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
CC: linux-next@vger.kernel.org
Link: https://lore.kernel.org/r/20191111230401.12958-2-jsmart2021@gmail.com
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-11-12 22:21:33 -05:00
..
lpfc_attr.c scsi: lpfc: Change default IRQ model on AMD architectures 2019-11-06 00:04:04 -05:00
lpfc_attr.h scsi: lpfc: Revise copyright for new company language 2018-07-10 22:15:09 -04:00
lpfc_bsg.c scsi: lpfc: Make FW logging dynamically configurable 2019-10-24 21:02:05 -04:00
lpfc_bsg.h scsi: lpfc: Update Copyright in driver version 2019-03-19 13:15:10 -04:00
lpfc_compat.h scsi: lpfc: Revise copyright for new company language 2018-07-10 22:15:09 -04:00
lpfc_crtn.h scsi: lpfc: Add registration for CPU Offline/Online events 2019-11-06 00:04:04 -05:00
lpfc_ct.c scsi: lpfc: Add additional discovery log messages 2019-10-24 21:02:06 -04:00
lpfc_debugfs.c scsi: lpfc: Make lpfc_debugfs_ras_log_data static 2019-10-28 22:02:28 -04:00
lpfc_debugfs.h scsi: lpfc: Merge per-protocol WQ/CQ pairs into single per-cpu pair 2019-08-19 22:41:12 -04:00
lpfc_disc.h scsi: lpfc: Add NVMe sequence level error recovery support 2019-08-19 22:41:12 -04:00
lpfc_els.c scsi: lpfc: Fix unexpected error messages during RSCN handling 2019-11-06 00:04:04 -05:00
lpfc_hbadisc.c scsi: lpfc: Clarify FAWNN error message 2019-11-06 00:04:04 -05:00
lpfc_hw4.h scsi: lpfc: Add enablement of multiple adapter dumps 2019-11-06 00:04:04 -05:00
lpfc_hw.h scsi: lpfc: Fix ELS field alignments 2019-08-19 22:41:08 -04:00
lpfc_ids.h scsi: lpfc: Revise copyright for new company language 2018-07-10 22:15:09 -04:00
lpfc_init.c scsi: lpfc: Fix lpfc_cpumask_of_node_init() 2019-11-08 21:29:42 -05:00
lpfc_logmsg.h scsi: lpfc: Add log macros to allow print by serverity or verbosity setting 2019-10-24 21:02:05 -04:00
lpfc_mbox.c scsi: lpfc: Add FC-AL support to lpe32000 models 2019-10-24 21:02:06 -04:00
lpfc_mem.c scsi: lpfc: Remove lock contention target write path 2019-10-24 21:02:05 -04:00
lpfc_nl.h scsi: lpfc: Revise copyright for new company language 2018-07-10 22:15:09 -04:00
lpfc_nportdisc.c scsi: lpfc: Sync with FC-NVMe-2 SLER change to require Conf with SLER 2019-11-06 00:04:04 -05:00
lpfc_nvme.c scsi: lpfc: Slight fast-path performance optimizations 2019-10-24 21:02:05 -04:00
lpfc_nvme.h SCSI misc on 20190306 2019-03-09 16:53:47 -08:00
lpfc_nvmet.c scsi: lpfc: lpfc_nvmet: Fix Use plain integer as NULL pointer 2019-10-24 21:12:08 -04:00
lpfc_nvmet.h scsi: lpfc: Remove lock contention target write path 2019-10-24 21:02:05 -04:00
lpfc_scsi.c scsi: lpfc: fix: Coverity: lpfc_get_scsi_buf_s3(): Null pointer dereferences 2019-11-12 22:21:33 -05:00
lpfc_scsi.h scsi: lpfc: Update 12.2.0.0 file copyrights to 2019 2019-02-05 22:29:50 -05:00
lpfc_sli4.h scsi: lpfc: Change default IRQ model on AMD architectures 2019-11-06 00:04:04 -05:00
lpfc_sli.c scsi: lpfc: Fix a kernel warning triggered by lpfc_get_sgl_per_hdwq() 2019-11-08 21:28:23 -05:00
lpfc_sli.h scsi: lpfc: Fix bad ndlp ptr in xri aborted handling 2019-10-24 21:02:04 -04:00
lpfc_version.h scsi: lpfc: Update lpfc version to 12.6.0.1 2019-11-06 00:04:04 -05:00
lpfc_vport.c scsi: lpfc: Fix issuing init_vpi mbox on SLI-3 card 2019-08-19 22:41:09 -04:00
lpfc_vport.h scsi: lpfc: Revise copyright for new company language 2018-07-10 22:15:09 -04:00
lpfc.h scsi: lpfc: Change default IRQ model on AMD architectures 2019-11-06 00:04:04 -05:00
Makefile scsi: lpfc: Revise copyright for new company language 2018-07-10 22:15:09 -04:00