[PATCH] resctrl: mpam: Fix potential per-CPU data leak on probe failure

Fenghua Yu fenghuay at nvidia.com
Fri Nov 20 12:23:54 PST 2026


Hi, Guangshuo,

nits:
Subject: [PATCH] resctrl: mpam: Fix potential per-CPU data leak on probe 
failure

1. s/resctrl: mpam/arm_mpam/
2. s/data leak/memory leak/. Without this fix, there is no "data" leak, 
which means information is disclosed, right? Not freed memory is memory 
leak, I think.

On 11/20/26 09:35, Guangshuo Li wrote:
> The PPI device IDs are allocated separately from the MSC. If subsequent
> resource discovery fails, probe destroys the MSC without freeing its
> per-CPU allocation.
> 
> Use devm_alloc_percpu() so the device releases the allocation when probe
> fails. Its cleanup remains valid even if the MSC is freed beforehand.
> 
> This issue was found by our static analysis tool under development.
> 
> Fixes: 49aa621c4dca ("arm_mpam: Register and enable IRQs")
> Cc: stable at vger.kernel.org
> Signed-off-by: Guangshuo Li <liguangshuo at mail.sdu.edu.cn>

Reviewed-by: Fenghua Yu <fenghuay at nvidia.com>

Thanks.

-Fenghua

> ---
>   drivers/resctrl/mpam_devices.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
> index c067b6d57d71..3e89f9183041 100644
> --- a/drivers/resctrl/mpam_devices.c
> +++ b/drivers/resctrl/mpam_devices.c
> @@ -2351,7 +2351,7 @@ static int __setup_ppi(struct mpam_msc *msc)
>   {
>   	int cpu;
>   
> -	msc->error_dev_id = alloc_percpu(struct mpam_msc *);
> +	msc->error_dev_id = devm_alloc_percpu(&msc->pdev->dev, struct mpam_msc *);
>   	if (!msc->error_dev_id)
>   		return -ENOMEM;
>   
> 
> base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4




More information about the linux-arm-kernel mailing list