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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1356627803.17740.11.camel@deadeye.wl.decadent.org.uk>
Date:	Thu, 27 Dec 2012 18:03:23 +0100
From:	Ben Hutchings <ben@...adent.org.uk>
To:	Paolo Pisati <paolo.pisati@...onical.com>
Cc:	linux-kernel@...r.kernel.org, stable@...r.kernel.org,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>
Subject: Re: [PATCH] [stable-resend] regulator: core: if voltage scaling
 fails, restore original voltage values

On Tue, 2012-12-18 at 00:23 +0100, Paolo Pisati wrote:
> Cc: stable@...r.kernel.org
> Signed-off-by: Paolo Pisati <paolo.pisati@...onical.com>
> Tested-by: Robert Nelson <robertcnelson@...il.com>
> Signed-off-by: Mark Brown <broonie@...nsource.wolfsonmicro.com>

Since this is not in Linus's tree, it is too early to request it be
applied to stable trees.  If it has gone into Mark's tree without the
'cc: stable' then it is probably too late to add that.  You'll need to
send a request after Linus has merged it.

Ben.

> ---
>  drivers/regulator/core.c |   16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index e872c8b..c347fd0 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -2250,6 +2250,7 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
>  {
>  	struct regulator_dev *rdev = regulator->rdev;
>  	int ret = 0;
> +	int old_min_uV, old_max_uV;
>  
>  	mutex_lock(&rdev->mutex);
>  
> @@ -2271,18 +2272,29 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
>  	ret = regulator_check_voltage(rdev, &min_uV, &max_uV);
>  	if (ret < 0)
>  		goto out;
> +	
> +	/* restore original values in case of error */
> +	old_min_uV = regulator->min_uV;
> +	old_max_uV = regulator->max_uV;
>  	regulator->min_uV = min_uV;
>  	regulator->max_uV = max_uV;
>  
>  	ret = regulator_check_consumers(rdev, &min_uV, &max_uV);
>  	if (ret < 0)
> -		goto out;
> +		goto out2;
>  
>  	ret = _regulator_do_set_voltage(rdev, min_uV, max_uV);
> -
> +	if (ret < 0)
> +		goto out2;
> +	
>  out:
>  	mutex_unlock(&rdev->mutex);
>  	return ret;
> +out2:
> +	regulator->min_uV = old_min_uV;
> +	regulator->max_uV = old_max_uV;
> +	mutex_unlock(&rdev->mutex);
> +	return ret;
>  }
>  EXPORT_SYMBOL_GPL(regulator_set_voltage);
>  

-- 
Ben Hutchings
The world is coming to an end.	Please log off.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ