[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CY8PR11MB71348C8D1C35AD7DE3DA63CD89C4A@CY8PR11MB7134.namprd11.prod.outlook.com>
Date: Tue, 4 Nov 2025 13:08:19 +0000
From: "Zhuo, Qiuxu" <qiuxu.zhuo@...el.com>
To: Ma Ke <make24@...as.ac.cn>, "jbaron@...mai.com" <jbaron@...mai.com>,
"bp@...en8.de" <bp@...en8.de>, "Luck, Tony" <tony.luck@...el.com>
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/ie31200: Fix error handling in ie31200_register_mci
Hi Ma Ke,
Thanks for this report.
> From: Ma Ke <make24@...as.ac.cn>
> Sent: Tuesday, November 4, 2025 9:23 AM
> To: jbaron@...mai.com; bp@...en8.de; Luck, Tony <tony.luck@...el.com>;
> Zhuo, Qiuxu <qiuxu.zhuo@...el.com>
> 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/ie31200: Fix error handling in ie31200_register_mci
>
> When mc > 0, ie31200_register_mci() initializes priv->dev but fails to call
> put_device() on it in the error path, causing a memory leak. Add proper
edac_mc_free() triggers mci_release(), which eventually frees mci->pvt_info,
so there are no memory leaks, and put_device() is NOT needed.
> put_device() call for priv->dev in the error handling path to balance
> device_initialize().
>
>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: d0742284ec6d ("EDAC/ie31200: Add Intel Raptor Lake-S SoCs support")
This is not a real bug.
No "Fixes" tag needed to avoid unnecessary backporting.
> Signed-off-by: Ma Ke <make24@...as.ac.cn>
> ---
> drivers/edac/ie31200_edac.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/edac/ie31200_edac.c b/drivers/edac/ie31200_edac.c index
> 5a080ab65476..a5a4bb24b72a 100644
> --- a/drivers/edac/ie31200_edac.c
> +++ b/drivers/edac/ie31200_edac.c
> @@ -528,6 +528,8 @@ static int ie31200_register_mci(struct pci_dev *pdev,
> struct res_config *cfg, in
> fail_unmap:
> iounmap(window);
> fail_free:
> + if (mc > 0)
Since both primary and secondary memory controllers invoke device_initialize(),
please remove this "if (mc > 0)" check to call put_device() unconditionally here.
> + put_device(&priv->dev);
> edac_mc_free(mci);
> return ret;
> }
Could you please address the comments above, update the commit messages,
and send v2?
Thanks!
-Qiuxu
Powered by blists - more mailing lists