Skip to content

Commit

Permalink
rtc: fix double lock on UIE emulation
Browse files Browse the repository at this point in the history
With commit 5ad31a5 ("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>
  • Loading branch information
Atsushi Nemoto authored and Linus Torvalds committed Aug 20, 2008
1 parent ff9bc51 commit 1d96469
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/rtc/rtc-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,14 @@ static long rtc_dev_ioctl(struct file *file,

#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
case RTC_UIE_OFF:
mutex_unlock(&rtc->ops_lock);
clear_uie(rtc);
break;
return 0;

case RTC_UIE_ON:
mutex_unlock(&rtc->ops_lock);
err = set_uie(rtc);
return err;
#endif
default:
err = -ENOTTY;
Expand Down

0 comments on commit 1d96469

Please sign in to comment.