hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/9840 ------------------ error_dev_id is allocated with alloc_percpu_gfp() in __setup_ppi(). Since it is a plain percpu allocation (not devm-managed like msc), devm_kfree() in the mpam_msc_setup() does not release it. When a PPI sharing conflict is detected and the function returns -EBUSY, error_dev_id is left allocated, leaking percpu memory. Free it before returning the error. Fixes: 79a4fc6c372c ("arm_mpam: Register and enable IRQs") Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- drivers/platform/mpam/mpam_devices.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/mpam_devices.c index 2f44e1cfbd1a8..f8b6fea70784c 100644 --- a/drivers/platform/mpam/mpam_devices.c +++ b/drivers/platform/mpam/mpam_devices.c @@ -1835,6 +1835,7 @@ static int __setup_ppi(struct mpam_msc *msc) pr_err_once("%s shares PPI with %s!\n", dev_name(&msc->pdev->dev), dev_name(&empty->pdev->dev)); + free_percpu(msc->error_dev_id); return -EBUSY; } *per_cpu_ptr(msc->error_dev_id, cpu) = msc; -- 2.43.0