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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0361ab5b-a26e-7631-9bae-8909715f6354@pengutronix.de>
Date:   Sun, 14 Mar 2021 10:40:24 +0100
From:   Ahmad Fatoum <a.fatoum@...gutronix.de>
To:     Adam Ford <aford173@...il.com>, linux-clk@...r.kernel.org
Cc:     Aisheng Dong <aisheng.dong@....com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Abel Vesa <abel.vesa@....com>, Stephen Boyd <sboyd@...nel.org>,
        Fabio Estevam <festevam@...il.com>,
        Michael Turquette <mturquette@...libre.com>,
        aford@...conembedded.com, linux-kernel@...r.kernel.org,
        NXP Linux Team <linux-imx@....com>,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        Shawn Guo <shawnguo@...nel.org>,
        Sascha Hauer <s.hauer@...gutronix.de>,
        linux-arm-kernel@...ts.infradead.org,
        Jerome Brunet <jbrunet@...libre.com>
Subject: Re: [PATCH V4] clk: imx: Fix reparenting of UARTs not associated with
 stdout

On 13.03.21 16:16, Ahmad Fatoum wrote:
>> +/* i.MX boards use device trees now.  For build tests without CONFIG_OF, do nothing */
>> +#ifdef CONFIG_OF
>>  	if (imx_keep_uart_clocks) {
>>  		int i;
>>  
>> -		imx_uart_clocks = clks;
>> -		for (i = 0; imx_uart_clocks[i]; i++)
>> -			clk_prepare_enable(*imx_uart_clocks[i]);
>> +		imx_uart_clocks = kcalloc(clk_count, sizeof(struct clk *), GFP_KERNEL);
>> +
>> +		if (!of_stdout)
>> +			return;
> 
> Memory leak. Just do if (imx_keep_uart_clocks && of_stdout)

Please dismiss. I overlooked that you free it in a later initcall.

>>  static int __init imx_clk_disable_uart(void)
>>  {
>> -	if (imx_keep_uart_clocks && imx_uart_clocks) {
>> +	if (imx_keep_uart_clocks && imx_enabled_uart_clocks) {
>>  		int i;
>>  
>> -		for (i = 0; imx_uart_clocks[i]; i++)
>> -			clk_disable_unprepare(*imx_uart_clocks[i]);
>> +		for (i = 0; i < imx_enabled_uart_clocks; i++) {
>> +			clk_disable_unprepare(imx_uart_clocks[i]);
>> +			clk_put(imx_uart_clocks[i]);
>> +		};
>> +		kfree(imx_uart_clocks);
>>  	}

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ