diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2008-08-20 17:09:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-20 18:40:31 -0400 |
commit | 1d96469a34781340b2cc9bdf97d5913eecdaa038 (patch) | |
tree | a1ffd32c3119714a1a4e242417f9b3f8e9388930 /drivers/rtc/rtc-dev.c | |
parent | ff9bc512f198eb47204f55b24c6fe3d36ed89592 (diff) |
rtc: fix double lock on UIE emulation
With commit 5ad31a575157147b43fa84ef1e21471661653878 ("rtc: remove BKL
for ioctl()"), RTC_UIE_ON ioctl cause double lock on rtc->ops_lock.
The ops_lock must not be held while set_uie() calls rtc_read_time()
which takes the lock. Also clear_uie() does not need ops_lock. This
patch fixes return value of RTC_UIE_OFF ioctl too.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: David Brownell <david-b@pacbell.net>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-dev.c')
-rw-r--r-- | drivers/rtc/rtc-dev.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 35dcc06eb3e2..f118252f3a9f 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c | |||
@@ -403,11 +403,14 @@ static long rtc_dev_ioctl(struct file *file, | |||
403 | 403 | ||
404 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL | 404 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL |
405 | case RTC_UIE_OFF: | 405 | case RTC_UIE_OFF: |
406 | mutex_unlock(&rtc->ops_lock); | ||
406 | clear_uie(rtc); | 407 | clear_uie(rtc); |
407 | break; | 408 | return 0; |
408 | 409 | ||
409 | case RTC_UIE_ON: | 410 | case RTC_UIE_ON: |
411 | mutex_unlock(&rtc->ops_lock); | ||
410 | err = set_uie(rtc); | 412 | err = set_uie(rtc); |
413 | return err; | ||
411 | #endif | 414 | #endif |
412 | default: | 415 | default: |
413 | err = -ENOTTY; | 416 | err = -ENOTTY; |