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:   Fri, 29 Jun 2018 15:41:45 +0100
From:   Jon Hunter <jonathanh@...dia.com>
To:     Mikko Perttunen <mperttunen@...dia.com>, <pdeschrijver@...dia.com>,
        <mturquette@...libre.com>, <sboyd@...nel.org>,
        <thierry.reding@...il.com>
CC:     <linux-clk@...r.kernel.org>, <linux-tegra@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <swarren@...dia.com>,
        <vbhadram@...dia.com>
Subject: Re: [PATCH] clk: tegra: bpmp: Don't crash when a clock fails to
 register


On 29/06/18 15:38, Mikko Perttunen wrote:
> When registering clocks, we just skip any that fail to register
> (leaving a NULL hole in the clock table). However, our of_xlate
> function still tries to dereference each entry while looking for
> the clock with the requested id, causing a crash if any clocks
> failed to register. Add a check to of_xlate to skip any NULL
> clocks.
> 
> Signed-off-by: Mikko Perttunen <mperttunen@...dia.com>
> ---
>  drivers/clk/tegra/clk-bpmp.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c
> index a896692b74ec..01dada561c10 100644
> --- a/drivers/clk/tegra/clk-bpmp.c
> +++ b/drivers/clk/tegra/clk-bpmp.c
> @@ -586,9 +586,15 @@ static struct clk_hw *tegra_bpmp_clk_of_xlate(struct of_phandle_args *clkspec,
>  	unsigned int id = clkspec->args[0], i;
>  	struct tegra_bpmp *bpmp = data;
>  
> -	for (i = 0; i < bpmp->num_clocks; i++)
> -		if (bpmp->clocks[i]->id == id)
> -			return &bpmp->clocks[i]->hw;
> +	for (i = 0; i < bpmp->num_clocks; i++) {
> +		struct tegra_bpmp_clk *clk = bpmp->clocks[i];
> +
> +		if (!clk)
> +			continue;
> +
> +		if (clk->id == id)
> +			return &clk->hw;
> +	}
>  
>  	return NULL;
>  }

Acked-by: Jon Hunter <jonathanh@...dia.com>

Cheers!
Jon

-- 
nvpublic

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ