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:	Mon, 2 Mar 2015 18:57:13 +0000
From:	Mark Brown <broonie@...nel.org>
To:	Javier Martinez Canillas <javier.martinez@...labora.co.uk>
Cc:	Doug Anderson <dianders@...omium.org>, milo.kim@...com,
	axel.lin@...ics.com, Dmitry Torokhov <dmitry.torokhov@...il.com>,
	olof@...om.net, Paul Stewart <pstew@...omium.org>,
	stable@...r.kernel.org, lgirdwood@...il.com,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] regulator: core: Fix enable GPIO reference counting

On Fri, Feb 27, 2015 at 10:01:23PM +0100, Javier Martinez Canillas wrote:

> I noticed the same problem in regulator_suspend_finish() when I was working
> on S2R for Exynos a couple of months ago and had patch [0] on my local tree
> but never found the time to do extensive testing so I never posted it.

Please don't bury patches in the middle of mails where they're hard to
apply if they're useful.

> I see that the check is already in _regulator_enable() so another option
> is to call _regulator_enable() instead of _regulator_do_enable() in
> regulator_suspend_finish().

I'm not entirely sure what "the check" is?

> Trying to enable an already enabled regulator may cause issues so is
> better to skip enabling regulators that were not disabled before suspend.

>  		mutex_lock(&rdev->mutex);
>  		if (rdev->use_count > 0  || rdev->constraints->always_on) {
> -			error = _regulator_do_enable(rdev);
> -			if (error)
> -				ret = error;
> +			if (!_regulator_is_enabled(rdev)) {
> +			    error = _regulator_do_enable(rdev);
> +			    if (error)
> +				    ret = error;
> +			}

This seems like a better fix or at least a better approach - essentially
the assumption in most of the code is that regulator enables are just
register writes so repeated updates don't have any effect.  We may need
a specific per client count here...  I've not looked at the code and I
only got back to the UK this morning so I'm not going to start now.

Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ