[PATCH] rtc subsystem: add capability checks
Centralize CAP_SYS_XXX checks to avoid duplicate code and missing checks in the drivers. Signed-off-by: Alessandro Zummo <a.zummo@towertech.it> Cc: Richard Purdie <rpurdie@rpsys.net> Cc: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:

committed by
Linus Torvalds

parent
56f10c634e
commit
110d693d58
@@ -229,8 +229,6 @@ static int sa1100_rtc_ioctl(struct device *dev, unsigned int cmd,
|
||||
spin_unlock_irq(&sa1100_rtc_lock);
|
||||
return 0;
|
||||
case RTC_PIE_ON:
|
||||
if ((rtc_freq > 64) && !capable(CAP_SYS_RESOURCE))
|
||||
return -EACCES;
|
||||
spin_lock_irq(&sa1100_rtc_lock);
|
||||
OSMR1 = TIMER_FREQ/rtc_freq + OSCR;
|
||||
OIER |= OIER_E1;
|
||||
@@ -242,8 +240,6 @@ static int sa1100_rtc_ioctl(struct device *dev, unsigned int cmd,
|
||||
case RTC_IRQP_SET:
|
||||
if (arg < 1 || arg > TIMER_FREQ)
|
||||
return -EINVAL;
|
||||
if ((arg > 64) && (!capable(CAP_SYS_RESOURCE)))
|
||||
return -EACCES;
|
||||
rtc_freq = arg;
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user