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]
Date:   Mon, 22 Mar 2021 13:05:26 +0200
From:   Abel Vesa <abelvesa@...nel.org>
To:     Adam Ford <aford173@...il.com>
Cc:     Ahmad Fatoum <a.fatoum@...gutronix.de>,
        linux-clk <linux-clk@...r.kernel.org>,
        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>,
        Adam Ford-BE <aford@...conembedded.com>,
        Linux Kernel Mailing List <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>,
        arm-soc <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 21-03-20 18:00:25, Adam Ford wrote:
> On Sun, Mar 14, 2021 at 4:40 AM Ahmad Fatoum <a.fatoum@...gutronix.de> wrote:
> >
> > 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.
> 
> Abel,
> 
> Are you OK with this?  I also have a V5 posted [1] which does what
> Ahmad suggested.
> 

I'm OK with this version. Applied it on my clk/imx branch:
git://git.kernel.org/pub/scm/linux/kernel/git/abelvesa/linux.git

Thanks a lot for all the effort.

> Either of these will fix reparenting issues, but I need this for
> Bluetooth to operate correctly, because both beacon imx8mn and imx8mn
> kits switch the UART parent to an 80MHz clock in order to run at
> 4Mbps.
> 
> thank you,
> 
> adam
> >
> > >>  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