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] [day] [month] [year] [list]
Message-ID: <e9d1f449-17ad-c4d9-05b0-779c7160433e@huawei.com>
Date:   Wed, 21 Jun 2023 12:00:42 +0800
From:   Miaohe Lin <linmiaohe@...wei.com>
To:     <tony.luck@...el.com>, <bp@...en8.de>
CC:     <james.morse@....com>, <mchehab@...nel.org>, <rric@...nel.org>,
        <linux-edac@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] EDAC/mc: fix potential memoryleak in edac_mc_alloc()

On 2023/6/3 22:41, Miaohe Lin wrote:
> When fails to allocate memory for layers or pvt_info, _edac_mc_free()
> will be called to release the resource of edac mc but mci->dev is not
> even initialized at that time. _edac_mc_free() will fail to release
> the allocated memory.

friendly ping.. :)

> 
> Fixes: 0bbb265f7089 ("EDAC/mc: Get rid of silly one-shot struct allocation in edac_mc_alloc()")
> Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
> ---
>  drivers/edac/edac_mc.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
> index 6faeb2ab3960..89dc5954d19e 100644
> --- a/drivers/edac/edac_mc.c
> +++ b/drivers/edac/edac_mc.c
> @@ -364,6 +364,8 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num,
>  	mci = kzalloc(sizeof(struct mem_ctl_info), GFP_KERNEL);
>  	if (!mci)
>  		return NULL;
> +	mci->dev.release = mci_release;
> +	device_initialize(&mci->dev);
>  
>  	mci->layers = kcalloc(n_layers, sizeof(struct edac_mc_layer), GFP_KERNEL);
>  	if (!mci->layers)
> @@ -373,9 +375,6 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num,
>  	if (!mci->pvt_info)
>  		goto error;
>  
> -	mci->dev.release = mci_release;
> -	device_initialize(&mci->dev);
> -
>  	/* setup index and various internal pointers */
>  	mci->mc_idx = mc_num;
>  	mci->tot_dimms = tot_dimms;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ