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: <DB9PR04MB847797F192398A62DE8D59CE800E9@DB9PR04MB8477.eurprd04.prod.outlook.com>
Date:   Thu, 17 Jun 2021 12:20:31 +0000
From:   Aisheng Dong <aisheng.dong@....com>
To:     Yang Yingliang <yangyingliang@...wei.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        dl-linux-imx <linux-imx@....com>
CC:     "shawnguo@...nel.org" <shawnguo@...nel.org>
Subject: RE: [PATCH -next v2 2/2] ARM: imx: add missing
 clk_disable_unprepare()

> From: Yang Yingliang <yangyingliang@...wei.com>
> Sent: Tuesday, June 15, 2021 8:53 PM
> 
> clock source is prepared and enabled by clk_prepare_enable() in probe
> function, but no disable or unprepare in remove and error path.
> 
> Fixes: 9454a0caff6a ("ARM: imx: add mmdc ipg clock operation for mmdc")
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>

Reviewed-by: Dong Aisheng <aisheng.dong@....com>

Regards
Aisheng

> ---
>  arch/arm/mach-imx/mmdc.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/mmdc.c b/arch/arm/mach-imx/mmdc.c index
> 8e57691aafe2..4a6f1359e1e9 100644
> --- a/arch/arm/mach-imx/mmdc.c
> +++ b/arch/arm/mach-imx/mmdc.c
> @@ -103,6 +103,7 @@ struct mmdc_pmu {
>  	struct perf_event *mmdc_events[MMDC_NUM_COUNTERS];
>  	struct hlist_node node;
>  	struct fsl_mmdc_devtype_data *devtype_data;
> +	struct clk *mmdc_ipg_clk;
>  };
> 
>  /*
> @@ -463,11 +464,13 @@ static int imx_mmdc_remove(struct
> platform_device *pdev)
>  	cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state,
> &pmu_mmdc->node);
>  	perf_pmu_unregister(&pmu_mmdc->pmu);
>  	iounmap(pmu_mmdc->mmdc_base);
> +	clk_disable_unprepare(pmu_mmdc->mmdc_ipg_clk);
>  	kfree(pmu_mmdc);
>  	return 0;
>  }
> 
> -static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem
> *mmdc_base)
> +static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem
> *mmdc_base,
> +			      struct clk *mmdc_ipg_clk)
>  {
>  	struct mmdc_pmu *pmu_mmdc;
>  	char *name;
> @@ -495,6 +498,7 @@ static int imx_mmdc_perf_init(struct platform_device
> *pdev, void __iomem *mmdc_b
>  	}
> 
>  	mmdc_num = mmdc_pmu_init(pmu_mmdc, mmdc_base, &pdev->dev);
> +	pmu_mmdc->mmdc_ipg_clk = mmdc_ipg_clk;
>  	if (mmdc_num == 0)
>  		name = "mmdc";
>  	else
> @@ -568,9 +572,11 @@ static int imx_mmdc_probe(struct platform_device
> *pdev)
>  	val &= ~(1 << BP_MMDC_MAPSR_PSD);
>  	writel_relaxed(val, reg);
> 
> -	err = imx_mmdc_perf_init(pdev, mmdc_base);
> -	if (err)
> +	err = imx_mmdc_perf_init(pdev, mmdc_base, mmdc_ipg_clk);
> +	if (err) {
>  		iounmap(mmdc_base);
> +		clk_disable_unprepare(mmdc_ipg_clk);
> +	}
> 
>  	return err;
>  }
> --
> 2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ