lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 31 May 2019 10:59:06 +0200
From:   Pavel Machek <pavel@....cz>
To:     pavel@....cz
Cc:     linux-kernel@...r.kernel.org,
        Himanshu Madhani <hmadhani@...vell.com>,
        Giridhar Malavali <gmalavali@...vell.com>,
        Bart Van Assche <bvanassche@....org>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 4.19 075/276] scsi: qla2xxx: Fix a qla24xx_enable_msix()
 error path


On Wed 2019-05-29 20:03:53, Greg Kroah-Hartman wrote:
> [ Upstream commit 24afabdbd0b3553963a2bbf465895492b14d1107 ]
> 
> Make sure that the allocated interrupts are freed if allocating memory for
> the msix_entries array fails.
> 
> Cc: Himanshu Madhani <hmadhani@...vell.com>
> Cc: Giridhar Malavali <gmalavali@...vell.com>
> Signed-off-by: Bart Van Assche <bvanassche@....org>
> Acked-by: Himanshu Madhani <hmadhani@...vell.com>
> Signed-off-by: Martin K. Petersen <martin.petersen@...cle.com>
> Signed-off-by: Sasha Levin <sashal@...nel.org>

> --- a/drivers/scsi/qla2xxx/qla_isr.c
> +++ b/drivers/scsi/qla2xxx/qla_isr.c
> @@ -3449,7 +3449,7 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
>  		ql_log(ql_log_fatal, vha, 0x00c8,
>  		    "Failed to allocate memory for ha->msix_entries.\n");
>  		ret = -ENOMEM;
> -		goto msix_out;
> +		goto free_irqs;

Could we just do > +     pci_free_irq_vectors(ha->pdev); return
-ENOMEM; here? Going through two gotos just does not feel right.

And yes, I'd replace msix_out with direct returns, too. gotos have
value when there's cleanup to be done, but we are not doing any here.

Thanks,
								Pavel

>  	}
>  	ha->flags.msix_enabled = 1;
>  
> @@ -3532,6 +3532,10 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
>  
>  msix_out:
>  	return ret;
> +
> +free_irqs:
> +	pci_free_irq_vectors(ha->pdev);
> +	goto msix_out;
>  }
>  

Come on, that is nasty. 

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ