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: <CY8PR11MB71347E33FB63F294BBC3F4CC89C4A@CY8PR11MB7134.namprd11.prod.outlook.com>
Date: Tue, 4 Nov 2025 14:22:34 +0000
From: "Zhuo, Qiuxu" <qiuxu.zhuo@...el.com>
To: Ma Ke <make24@...as.ac.cn>, "Luck, Tony" <tony.luck@...el.com>,
	"bp@...en8.de" <bp@...en8.de>
CC: "linux-edac@...r.kernel.org" <linux-edac@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
	"stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: RE: [PATCH] EDAC/igen6: Fix error handling in igen6_edac driver

Hi Ma Ke,

> From: Ma Ke <make24@...as.ac.cn>
> Sent: Monday, November 3, 2025 8:40 PM
> To: Luck, Tony <tony.luck@...el.com>; Zhuo, Qiuxu <qiuxu.zhuo@...el.com>;
> bp@...en8.de
> Cc: linux-edac@...r.kernel.org; linux-kernel@...r.kernel.org; akpm@...ux-
> foundation.org; Ma Ke <make24@...as.ac.cn>; stable@...r.kernel.org
> Subject: [PATCH] EDAC/igen6: Fix error handling in igen6_edac driver
> 
> The igen6_edac driver fails to release reference for non-primary memory
> controllers during both error handling and normal shutdown.
> After device_initialize() is called in igen6_register_mci(), missing
> put_device() calls in error paths and igen6_unregister_mcis() cause reference
> count leaks, resulting in memory leaks and improper device cleanup.
>

If igen6_register_mci()fails, kfree(igen6_pvt) is called, and then imc->dev is eventually released. 
So there are no memory leaks, and put_device() is not needed. 

But from the perspective of pairing with device_initialize() for better code readability, 
then we may add put_device().
 
> Found by code review.
> 
> Cc: stable@...r.kernel.org
> Fixes: 10590a9d4f23 ("EDAC/igen6: Add EDAC driver for Intel client SoCs using

This is NOT a real bug.
Please don't add this "Fixes" tag in v2 to avoid unnecessary backporting.

> IBECC")
> Signed-off-by: Ma Ke <make24@...as.ac.cn>
> ---
>  drivers/edac/igen6_edac.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/edac/igen6_edac.c b/drivers/edac/igen6_edac.c index
> 2fc59f9eed69..ee2f00b204bb 100644
> --- a/drivers/edac/igen6_edac.c
> +++ b/drivers/edac/igen6_edac.c
> @@ -1300,6 +1300,8 @@ static int igen6_register_mci(int mc, void __iomem
> *window, struct pci_dev *pdev
>  	imc->mci = mci;
>  	return 0;
>  fail3:
> +	if (mc != 0)

Since all memory controllers call device_initialize(), 
please remove "if (mc != 0)" for unconditionally calls put_device().

> +		put_device(&imc->dev);
>  	mci->pvt_info = NULL;
>  	kfree(mci->ctl_name);
>  fail2:
> @@ -1326,6 +1328,8 @@ static void igen6_unregister_mcis(void)
>  		kfree(mci->ctl_name);
>  		mci->pvt_info = NULL;
>  		edac_mc_free(mci);
> +		if (imc->mc != 0)

Same as above, remove this "if()" check.

> +			put_device(&imc->dev);
>  		iounmap(imc->window);
>  	}
>  }

Could you please address the comments above, update the commit messages,
and send v2?

Thanks!
-Qiuxu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ