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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 6 Jun 2019 12:22:55 -0700
From:   James Smart <james.smart@...adcom.com>
To:     Nathan Chancellor <natechancellor@...il.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Pavel Machek <pavel@...x.de>, linux-kernel@...r.kernel.org,
        stable@...r.kernel.org, Arnd Bergmann <arnd@...db.de>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH] scsi: lpfc: Fix backport of faf5a744f4f8 ("scsi: lpfc:
 avoid uninitialized variable warning")

On 6/6/2019 10:41 AM, Nathan Chancellor wrote:
> Prior to commit 4c47efc140fa ("scsi: lpfc: Move SCSI and NVME Stats to
> hardware queue structures") upstream, we allocated a cstat structure in
> lpfc_nvme_create_localport. When commit faf5a744f4f8 ("scsi: lpfc: avoid
> uninitialized variable warning") was backported, it was placed after the
> allocation so we leaked memory whenever this function was called and
> that conditional was true (so whenever CONFIG_NVME_FC is disabled).
>
> Move the IS_ENABLED if statement above the allocation since it is not
> needed when the condition is true.
>
> Reported-by: Pavel Machek <pavel@...x.de>
> Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
> ---
>   drivers/scsi/lpfc/lpfc_nvme.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c
> index 099f70798fdd..645ffb5332b4 100644
> --- a/drivers/scsi/lpfc/lpfc_nvme.c
> +++ b/drivers/scsi/lpfc/lpfc_nvme.c
> @@ -2477,14 +2477,14 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport)
>   	lpfc_nvme_template.max_sgl_segments = phba->cfg_nvme_seg_cnt + 1;
>   	lpfc_nvme_template.max_hw_queues = phba->cfg_nvme_io_channel;
>   
> +	if (!IS_ENABLED(CONFIG_NVME_FC))
> +		return ret;
> +
>   	cstat = kmalloc((sizeof(struct lpfc_nvme_ctrl_stat) *
>   			phba->cfg_nvme_io_channel), GFP_KERNEL);
>   	if (!cstat)
>   		return -ENOMEM;
>   
> -	if (!IS_ENABLED(CONFIG_NVME_FC))
> -		return ret;
> -
>   	/* localport is allocated from the stack, but the registration
>   	 * call allocates heap memory as well as the private area.
>   	 */

Reviewed-by: James Smart <james.smart@...adcom.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ