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, 22 Jul 2016 09:21:51 -0700
From:	Viresh Kumar <viresh.kumar@...aro.org>
To:	Jisheng Zhang <jszhang@...vell.com>
Cc:	vireshk@...nel.org, nm@...com, sboyd@...eaurora.org,
	rjw@...ysocki.net, gregkh@...uxfoundation.org,
	linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] PM / OPP: optimize dev_pm_opp_set_rate() a bit

On 22-07-16, 20:42, Jisheng Zhang wrote:
>  static int _set_opp_voltage(struct device *dev, struct regulator *reg,
>  			    unsigned long u_volt, unsigned long u_volt_min,
>  			    unsigned long u_volt_max)
> @@ -586,9 +565,24 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
>  		return -EINVAL;
>  	}
>  
> -	clk = _get_opp_clk(dev);
> -	if (IS_ERR(clk))
> +	rcu_read_lock();
> +
> +	opp_table = _find_opp_table(dev);
> +	if (IS_ERR(opp_table)) {
> +		dev_err(dev, "%s: device opp doesn't exist\n", __func__);
> +		rcu_read_unlock();
> +		return PTR_ERR(opp_table);
> +	}
> +
> +	clk = opp_table->clk;
> +	if (IS_ERR(clk)) {
> +		dev_err(dev, "%s: No clock available for the device\n",
> +			__func__);
> +		rcu_read_unlock();
>  		return PTR_ERR(clk);
> +	}
> +
> +	rcu_read_unlock();

It is not _safe_ to use opp_table pointer after the rcu_read_unlock()
here.

-- 
viresh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ