Re: [PATCH v2 2/3] qla2xxx: on session delete return nvme cmd

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

 



Thanks Dan for reporting the issue.

This is already fixed in v3 of the patch:
	https://marc.info/?l=linux-scsi&m=156113583805280&w=2

Regards,
-Arun

On Tue, 25 Jun 2019, 11:20pm, Dan Carpenter wrote:

> Hi Himanshu,
> 
> url:    https://github.com/0day-ci/linux/commits/Himanshu-Madhani/qla2xxx-Fix-crashes-with-FC-NVMe-devices/20190619-074559
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
> 
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@xxxxxxxxx>
> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> 
> New smatch warnings:
> drivers/scsi/qla2xxx/qla_nvme.c:245 qla_nvme_ls_req() warn: variable dereferenced before check 'fcport' (see line 242)
> drivers/scsi/qla2xxx/qla_nvme.c:496 qla_nvme_post_cmd() warn: variable dereferenced before check 'fcport' (see line 494)
> drivers/scsi/qla2xxx/qla_nvme.c:510 qla_nvme_post_cmd() error: we previously assumed 'qpair' could be null (see line 496)
> 
> Old smatch warnings:
> drivers/scsi/qla2xxx/qla_nvme.c:190 qla_nvme_abort_work() warn: variable dereferenced before check 'fcport' (see line 183)
> 
> # https://github.com/0day-ci/linux/commit/69efeca5ca5e394664f54ef8e349a31b0f424507
> git remote add linux-review https://github.com/0day-ci/linux
> git remote update linux-review
> git checkout 69efeca5ca5e394664f54ef8e349a31b0f424507
> vim +/fcport +245 drivers/scsi/qla2xxx/qla_nvme.c
> 
> e84067d7 Duane Grigsby               2017-06-21  230  static int qla_nvme_ls_req(struct nvme_fc_local_port *lport,
> e84067d7 Duane Grigsby               2017-06-21  231      struct nvme_fc_remote_port *rport, struct nvmefc_ls_req *fd)
> e84067d7 Duane Grigsby               2017-06-21  232  {
> 9dd9686b Darren Trapp                2018-03-20  233  	struct qla_nvme_rport *qla_rport = rport->private;
> 9dd9686b Darren Trapp                2018-03-20  234  	fc_port_t *fcport = qla_rport->fcport;
> e84067d7 Duane Grigsby               2017-06-21  235  	struct srb_iocb   *nvme;
> e84067d7 Duane Grigsby               2017-06-21  236  	struct nvme_private *priv = fd->private;
> e84067d7 Duane Grigsby               2017-06-21  237  	struct scsi_qla_host *vha;
> e84067d7 Duane Grigsby               2017-06-21  238  	int     rval = QLA_FUNCTION_FAILED;
> e84067d7 Duane Grigsby               2017-06-21  239  	struct qla_hw_data *ha;
> e84067d7 Duane Grigsby               2017-06-21  240  	srb_t           *sp;
> e84067d7 Duane Grigsby               2017-06-21  241  
> e84067d7 Duane Grigsby               2017-06-21 @242  	vha = fcport->vha;
>                                                               ^^^^^^^^^^^
> Dereference.
> 
> e84067d7 Duane Grigsby               2017-06-21  243  	ha = vha->hw;
> 69efeca5 Quinn Tran                  2019-06-18  244  
> 69efeca5 Quinn Tran                  2019-06-18 @245  	if (!ha->flags.fw_started || (fcport && fcport->deleted))
>                                                                                       ^^^^^^
> Check for NULL is too late.
> 
> 69efeca5 Quinn Tran                  2019-06-18  246  		return rval;
> 69efeca5 Quinn Tran                  2019-06-18  247  
> e84067d7 Duane Grigsby               2017-06-21  248  	/* Alloc SRB structure */
> e84067d7 Duane Grigsby               2017-06-21  249  	sp = qla2x00_get_sp(vha, fcport, GFP_ATOMIC);
> e84067d7 Duane Grigsby               2017-06-21  250  	if (!sp)
> e84067d7 Duane Grigsby               2017-06-21  251  		return rval;
> e84067d7 Duane Grigsby               2017-06-21  252  
> e84067d7 Duane Grigsby               2017-06-21  253  	sp->type = SRB_NVME_LS;
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
> 



[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