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: <1290419947.1272.16677.camel@rex>
Date:	Mon, 22 Nov 2010 09:59:07 +0000
From:	Richard Purdie <rpurdie@...ux.intel.com>
To:	Uwe Kleine-König 
	<u.kleine-koenig@...gutronix.de>, akpm <akpm@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org, kernel@...gutronix.de
Subject: Re: [PATCH] backlight: grab ops_lock before testing bd->ops

On Mon, 2010-11-22 at 10:43 +0100, Uwe Kleine-König wrote:
> According to the comment describing ops_lock in the definition of
> struct backlight_device and when comparing with other functions in
> backlight.c the mutex must be hold when checking ops to be non-NULL.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>

Acked-by: Richard Purdie <rpurdie@...ux.intel.com>

> ---
>  drivers/video/backlight/backlight.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
> index e207810..0870329 100644
> --- a/drivers/video/backlight/backlight.c
> +++ b/drivers/video/backlight/backlight.c
> @@ -197,12 +197,12 @@ static int backlight_suspend(struct device *dev, pm_message_t state)
>  {
>  	struct backlight_device *bd = to_backlight_device(dev);
>  
> -	if (bd->ops->options & BL_CORE_SUSPENDRESUME) {
> -		mutex_lock(&bd->ops_lock);
> +	mutex_lock(&bd->ops_lock);
> +	if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) {
>  		bd->props.state |= BL_CORE_SUSPENDED;
>  		backlight_update_status(bd);
> -		mutex_unlock(&bd->ops_lock);
>  	}
> +	mutex_unlock(&bd->ops_lock);
>  
>  	return 0;
>  }
> @@ -211,12 +211,12 @@ static int backlight_resume(struct device *dev)
>  {
>  	struct backlight_device *bd = to_backlight_device(dev);
>  
> -	if (bd->ops->options & BL_CORE_SUSPENDRESUME) {
> -		mutex_lock(&bd->ops_lock);
> +	mutex_lock(&bd->ops_lock);
> +	if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) {
>  		bd->props.state &= ~BL_CORE_SUSPENDED;
>  		backlight_update_status(bd);
> -		mutex_unlock(&bd->ops_lock);
>  	}
> +	mutex_unlock(&bd->ops_lock);
>  
>  	return 0;
>  }


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ