From: Hao Chen chenhao418@huawei.com
mainline inclusion from mainline-v6.9-rc1 commit 582c1aeee0a9e73010cf1c4cef338709860deeb0 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I9HCSA CVE: CVE-2024-38603
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/commit/?h=for...
------------------------------------------------------------------------
pci_alloc_irq_vectors() allocates an irq vector. When devm_add_action() fails, the irq vector is not freed, which leads to a memory leak.
Replace the devm_add_action with devm_add_action_or_reset to ensure the irq vector can be destroyed when it fails.
Fixes: 66637ab137b4 ("drivers/perf: hisi: add driver for HNS3 PMU") Signed-off-by: Hao Chen chenhao418@huawei.com Signed-off-by: Junhao He hejunhao3@huawei.com Reviewed-by: Jijie Shao shaojijie@huawei.com Acked-by: Jonathan Cameron Jonathan.Cameron@huawei.com Link: https://lore.kernel.org/r/20240425124627.13764-4-hejunhao3@huawei.com Signed-off-by: Will Deacon will@kernel.org Signed-off-by: Slim6882 yangjunshuo@huawei.com Signed-off-by: Tong Tiangen tongtiangen@huawei.com --- drivers/perf/hisilicon/hns3_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/perf/hisilicon/hns3_pmu.c b/drivers/perf/hisilicon/hns3_pmu.c index 08b2068b5278..40edc4cfcc34 100644 --- a/drivers/perf/hisilicon/hns3_pmu.c +++ b/drivers/perf/hisilicon/hns3_pmu.c @@ -1518,7 +1518,7 @@ static int hns3_pmu_irq_register(struct pci_dev *pdev, return ret; }
- ret = devm_add_action(&pdev->dev, hns3_pmu_free_irq, pdev); + ret = devm_add_action_or_reset(&pdev->dev, hns3_pmu_free_irq, pdev); if (ret) { pci_err(pdev, "failed to add free irq action, ret = %d.\n", ret); return ret;
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/9733 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/Y...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/9733 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/Y...