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]
Message-ID: <20200221144003.GD15440@e121166-lin.cambridge.arm.com>
Date:   Fri, 21 Feb 2020 14:40:03 +0000
From:   Lorenzo Pieralisi <lorenzo.pieralisi@....com>
To:     Dexuan Cui <decui@...rosoft.com>
Cc:     kys@...rosoft.com, haiyangz@...rosoft.com, sthemmin@...rosoft.com,
        sashal@...nel.org, bhelgaas@...gle.com,
        linux-hyperv@...r.kernel.org, linux-pci@...r.kernel.org,
        linux-kernel@...r.kernel.org, mikelley@...rosoft.com,
        Alexander.Levin@...rosoft.com
Subject: Re: [PATCH] PCI: hv: Use kfree(hbus) in hv_pci_probe()'s error
 handling path

On Mon, Jan 06, 2020 at 02:39:11PM -0800, Dexuan Cui wrote:
> Now that we use kzalloc() to allocate the hbus buffer, we should use
> kfree() in the error path as well.
> 
> Also remove the type casting, since it's unnecessary in C.

Two unrelated logical changes -> two patches please, I know it is
tempting but it is important to split logical changes into separate
patches.

Thanks,
Lorenzo

> Fixes: 877b911a5ba0 ("PCI: hv: Avoid a kmemleak false positive caused by the hbus buffer")
> Signed-off-by: Dexuan Cui <decui@...rosoft.com>
> ---
> 
> Sorry for missing the error handling path.
> 
>  drivers/pci/controller/pci-hyperv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> index 9977abff92fc..15011a349520 100644
> --- a/drivers/pci/controller/pci-hyperv.c
> +++ b/drivers/pci/controller/pci-hyperv.c
> @@ -2922,7 +2922,7 @@ static int hv_pci_probe(struct hv_device *hdev,
>  	 * positive by using kmemleak_alloc() and kmemleak_free() to ask
>  	 * kmemleak to track and scan the hbus buffer.
>  	 */
> -	hbus = (struct hv_pcibus_device *)kzalloc(HV_HYP_PAGE_SIZE, GFP_KERNEL);
> +	hbus = kzalloc(HV_HYP_PAGE_SIZE, GFP_KERNEL);
>  	if (!hbus)
>  		return -ENOMEM;
>  	hbus->state = hv_pcibus_init;
> @@ -3058,7 +3058,7 @@ static int hv_pci_probe(struct hv_device *hdev,
>  free_dom:
>  	hv_put_dom_num(hbus->sysdata.domain);
>  free_bus:
> -	free_page((unsigned long)hbus);
> +	kfree(hbus);
>  	return ret;
>  }
>  
> -- 
> 2.19.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ