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: <alpine.LFD.2.02.1211012343120.2756@ionos>
Date:	Thu, 1 Nov 2012 23:55:31 +0100 (CET)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Chuansheng Liu <chuansheng.liu@...el.com>
cc:	john.stultz@...aro.org, gregkh@...uxfoundation.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] alarmtimer: Using the alarmtimer_get_rtcdev for all
 posix clock interface

On Thu, 1 Nov 2012, Chuansheng Liu wrote:
> 
> Some posix clock interface directly use the variable rtcdev,
> cleanup it here by alarmtimer_get_rtcdev().
> 
> Signed-off-by: liu chuansheng <chuansheng.liu@...el.com>
> ---
>  kernel/time/alarmtimer.c |   13 ++++++-------
>  1 files changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
> index 4fc17cb..5490fa8 100644
> --- a/kernel/time/alarmtimer.c
> +++ b/kernel/time/alarmtimer.c
> @@ -86,11 +86,10 @@ static int alarmtimer_rtc_add_device(struct device *dev,
>  		return -1;
>  
>  	mutex_lock(&rtcdev_mutex);
> -	if (!rtcdev) {
> -		rtcdev = rtc;
> -		/* hold a reference so it doesn't go away */
> -		get_device(dev);
> -	}
> +	rtcdev = rtc;
> +	/* hold a reference so it doesn't go away */
> +	get_device(dev);
> +

Brilliant. 

rtcdev = NULL

CPU0				CPU 1

alarmtimer_rtc_add_device(A)
	if (rtcdev)		alarmtimer_rtc_add_device(B)
	     return -EBUSY;		if (rtcdev)
	mutex_lock();				return -EBUSY;
	rtcdev = A;			mutex_lock();	
	mutex_unlock;

bla = alarmtimer_rtc_get_device()

So bla = A
      				  	mutex_lock() returns
      				  	rtcdev = B;
					mutex_unlock();

The next call to alarmtimer_rtc_get_device() will return B. Not what
you want. Maybe you want that, but then your patch is missing an
explanation why you want that and why this would be a desired
behaviour.

Thanks,

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