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] [thread-next>] [day] [month] [year] [list]
Message-ID: <9c402089-1aed-4777-84af-5879bf72624b@huawei.com>
Date: Fri, 26 Apr 2024 18:17:36 +0800
From: Jijie Shao <shaojijie@...wei.com>
To: Junhao He <hejunhao3@...wei.com>, <will@...nel.org>,
	<jonathan.cameron@...wei.com>, <yangyicong@...wei.com>
CC: <shaojijie@...wei.com>, <linux-kernel@...r.kernel.org>,
	<linux-arm-kernel@...ts.infradead.org>, <linuxarm@...wei.com>,
	<prime.zeng@...ilicon.com>, <chenhao418@...wei.com>
Subject: Re: [PATCH 3/3] drivers/perf: hisi: hns3: Actually use
 devm_add_action_or_reset()

Reviewed-by: Jijie Shao<shaojijie@...wei.com>

on 2024/4/25 20:46, Junhao He wrote:
> From: Hao Chen <chenhao418@...wei.com>
>
> 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@...wei.com>
> Signed-off-by: Junhao He <hejunhao3@...wei.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 cbdd53b0a034..60062eaa342a 100644
> --- a/drivers/perf/hisilicon/hns3_pmu.c
> +++ b/drivers/perf/hisilicon/hns3_pmu.c
> @@ -1527,7 +1527,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;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ