Re: [PATCH] qla2xxx: Fix a NULL pointer dereference in an error path

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

 



On Sun, Jan 12, 2020 at 01:08:46PM -0800, Bart Van Assche wrote:
> This patch fixes the following Coverity complaint:
> 
> FORWARD_NULL
> 
> qla_init.c: 5275 in qla2x00_configure_local_loop()
> 5269
> 5270     		if (fcport->scan_state == QLA_FCPORT_FOUND)
> 5271     			qla24xx_fcport_handle_login(vha, fcport);
> 5272     	}
> 5273
> 5274     cleanup_allocation:
> >>>     CID 353340:    (FORWARD_NULL)
> >>>     Passing null pointer "new_fcport" to "qla2x00_free_fcport", which dereferences it.
> 5275     	qla2x00_free_fcport(new_fcport);
> 5276
> 5277     	if (rval != QLA_SUCCESS) {
> 5278     		ql_dbg(ql_dbg_disc, vha, 0x2098,
> 5279     		    "Configure local loop error exit: rval=%x.\n", rval);
> 5280     	}
> 
> ---
>  drivers/scsi/qla2xxx/qla_init.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
> index c4e087217484..6560908ed50e 100644
> --- a/drivers/scsi/qla2xxx/qla_init.c
> +++ b/drivers/scsi/qla2xxx/qla_init.c
> @@ -4895,6 +4895,8 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags)
>  void
>  qla2x00_free_fcport(fc_port_t *fcport)
>  {
> +	if (!fcport)
> +		return;
>  	if (fcport->ct_desc.ct_sns) {
>  		dma_free_coherent(&fcport->vha->hw->pdev->dev,
>  			sizeof(struct ct_sns_pkt), fcport->ct_desc.ct_sns,

Hi Bart,

Reviewed-by: Roman Bolshakov <r.bolshakov@xxxxxxxxx>

There was another attempt to fix the issue a week ago:
https://patchwork.kernel.org/patch/11319315/

CC'ing Colin.

Thanks,
Roman



[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