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: <20161024225238.GR26139@codeaurora.org>
Date:   Mon, 24 Oct 2016 15:52:38 -0700
From:   Stephen Boyd <sboyd@...eaurora.org>
To:     Viresh Kumar <viresh.kumar@...aro.org>
Cc:     Rafael Wysocki <rjw@...ysocki.net>, nm@...com,
        Viresh Kumar <vireshk@...nel.org>,
        linaro-kernel@...ts.linaro.org, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Vincent Guittot <vincent.guittot@...aro.org>, robh@...nel.org,
        d-gerlach@...com, broonie@...nel.org
Subject: Re: [PATCH V2 2/8] PM / OPP: Don't use OPP structure outside of rcu
 protected section

On 10/20, Viresh Kumar wrote:
> The OPP structure must not be used out of the rcu protected section.
> Cache the values to be used in separate variables instead.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>

Was this found by visual inspection or through some static
checker? Just curious.

> @@ -633,6 +634,14 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
>  		return ret;
>  	}
>  
> +	if (IS_ERR(old_opp)) {
> +		old_u_volt = 0;
> +	} else {
> +		old_u_volt = old_opp->u_volt;
> +		old_u_volt_min = old_opp->u_volt_min;
> +		old_u_volt_max = old_opp->u_volt_max;
> +	}
> +
>  	u_volt = opp->u_volt;
>  	u_volt_min = opp->u_volt_min;
>  	u_volt_max = opp->u_volt_max;
> @@ -677,9 +686,10 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
>  			__func__, old_freq);
>  restore_voltage:
>  	/* This shouldn't harm even if the voltages weren't updated earlier */
> -	if (!IS_ERR(old_opp))
> -		_set_opp_voltage(dev, reg, old_opp->u_volt,
> -				 old_opp->u_volt_min, old_opp->u_volt_max);
> +	if (old_u_volt) {

What if old_u_volt == 0 is valid? We could have another variable
like 'valid' or something that we use to figure out if we should
set values instead. Then this isn't a potential pitfall.

> +		_set_opp_voltage(dev, reg, old_u_volt, old_u_volt_min,
> +				 old_u_volt_max);
> +	}
>  
>  	return ret;
>  }

-- 
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