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: <5256c34e-5afb-2cfe-9818-8e6a6e1f0fa3@nvidia.com>
Date:   Thu, 15 Sep 2016 12:03:27 +0100
From:   Jon Hunter <jonathanh@...dia.com>
To:     Tomeu Vizoso <tomeu.vizoso@...labora.com>,
        <linux-kernel@...r.kernel.org>
CC:     Heiko Stuebner <heiko@...ech.de>,
        "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Kevin Hilman <khilman@...nel.org>,
        Ulf Hansson <ulf.hansson@...aro.org>,
        "Len Brown" <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        <linux-pm@...r.kernel.org>
Subject: Re: [PATCH] PM / Domains: Allow holes in genpd_data.domains array


On 15/09/16 11:39, Tomeu Vizoso wrote:
> In platforms such as Rockchip's, the array of domains isn't always
> filled without holes, as which domains are present depend on the
> particular SoC revision.
> 
> By allowing holes to be in the array, such SoCs can still use a single
> set of constants to index the array of power domains.
> 
> Fixes: 0159ec670763 ("PM / Domains: Verify the PM domain is present when adding a provider")
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@...labora.com>
> Cc: Jon Hunter <jonathanh@...dia.com>
> Cc: Heiko Stuebner <heiko@...ech.de>
> ---
>  drivers/base/power/domain.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index b0cf46dcae73..ce3f483ec67b 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -1581,6 +1581,8 @@ int of_genpd_add_provider_onecell(struct device_node *np,
>  	mutex_lock(&gpd_list_lock);
>  
>  	for (i = 0; i < data->num_domains; i++) {
> +		if (!data->domains[i])
> +			continue;
>  		if (!pm_genpd_present(data->domains[i]))
>  			goto error;
>  

Sounds reasonable and sorry I had not thought of this. Can you also make
sure we check that !data->domains[i] in the error path as well or
potentially we could have a NULL pointer dereference in the case of an
actual error.

Cheers
Jon

-- 
nvpublic

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ