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: <20190913144444.GA25762@jcrouse1-lnx.qualcomm.com>
Date:   Fri, 13 Sep 2019 08:44:45 -0600
From:   Jordan Crouse <jcrouse@...eaurora.org>
To:     Bjorn Andersson <bjorn.andersson@...aro.org>
Cc:     Michael Turquette <mturquette@...libre.com>,
        Stephen Boyd <sboyd@...nel.org>, linux-clk@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
        Dong Aisheng <aisheng.dong@....com>
Subject: Re: [PATCH] clk: Make clk_bulk_get_all() return a valid "id"

On Thu, Sep 12, 2019 at 07:40:29PM -0700, Bjorn Andersson wrote:
> The adreno driver expects the "id" field of the returned clk_bulk_data
> to be filled in with strings from the clock-names property.
> 
> But due to the use of kmalloc_array() in of_clk_bulk_get_all() it
> receives a list of bogus pointers instead.
> 
> Zero-initialize the "id" field and attempt to populate with strings from
> the clock-names property to resolve both these issues.

This looks great to me.  Thanks for fixing that so quickly.

Reviewed-by: Jordan Crouse <jcrouse@...eaurora.org>

> Fixes: 616e45df7c4a ("clk: add new APIs to operate on all available clocks")
> Fixes: 8e3e791d20d2 ("drm/msm: Use generic bulk clock function")
> Cc: Dong Aisheng <aisheng.dong@....com>
> Cc: Jordan Crouse <jcrouse@...eaurora.org>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@...aro.org>
> ---
>  drivers/clk/clk-bulk.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c
> index 524bf9a53098..e9e16425c739 100644
> --- a/drivers/clk/clk-bulk.c
> +++ b/drivers/clk/clk-bulk.c
> @@ -18,10 +18,13 @@ static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks,
>  	int ret;
>  	int i;
>  
> -	for (i = 0; i < num_clks; i++)
> +	for (i = 0; i < num_clks; i++) {
> +		clks[i].id = NULL;
>  		clks[i].clk = NULL;
> +	}
>  
>  	for (i = 0; i < num_clks; i++) {
> +		of_property_read_string_index(np, "clock-names", i, &clks[i].id);
>  		clks[i].clk = of_clk_get(np, i);
>  		if (IS_ERR(clks[i].clk)) {
>  			ret = PTR_ERR(clks[i].clk);
> -- 
> 2.18.0
> 

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ