aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-vr41xx.c
diff options
context:
space:
mode:
authorAlessandro Zummo <alessandro.zummo@towertech.it>2006-06-25 08:48:20 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 13:01:14 -0400
commit110d693d5898649da606cd6e5f6af4d7f70a405f (patch)
treea46b06a383d8a9eda59d7c7e17e8694798769800 /drivers/rtc/rtc-vr41xx.c
parent56f10c634e145d75e45b56a73f59fb6dff1caa8e (diff)
[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>
Diffstat (limited to 'drivers/rtc/rtc-vr41xx.c')
-rw-r--r--drivers/rtc/rtc-vr41xx.c8
1 files changed, 0 insertions, 8 deletions
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c
index 277596c302e3..33e029207e26 100644
--- a/drivers/rtc/rtc-vr41xx.c
+++ b/drivers/rtc/rtc-vr41xx.c
@@ -81,7 +81,6 @@ MODULE_LICENSE("GPL");
81 81
82#define RTC_FREQUENCY 32768 82#define RTC_FREQUENCY 32768
83#define MAX_PERIODIC_RATE 6553 83#define MAX_PERIODIC_RATE 6553
84#define MAX_USER_PERIODIC_RATE 64
85 84
86static void __iomem *rtc1_base; 85static void __iomem *rtc1_base;
87static void __iomem *rtc2_base; 86static void __iomem *rtc2_base;
@@ -240,9 +239,6 @@ static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long
240 if (arg > MAX_PERIODIC_RATE) 239 if (arg > MAX_PERIODIC_RATE)
241 return -EINVAL; 240 return -EINVAL;
242 241
243 if (arg > MAX_USER_PERIODIC_RATE && capable(CAP_SYS_RESOURCE) == 0)
244 return -EACCES;
245
246 periodic_frequency = arg; 242 periodic_frequency = arg;
247 243
248 count = RTC_FREQUENCY; 244 count = RTC_FREQUENCY;
@@ -263,10 +259,6 @@ static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long
263 /* Doesn't support before 1900 */ 259 /* Doesn't support before 1900 */
264 if (arg < 1900) 260 if (arg < 1900)
265 return -EINVAL; 261 return -EINVAL;
266
267 if (capable(CAP_SYS_TIME) == 0)
268 return -EACCES;
269
270 epoch = arg; 262 epoch = arg;
271 break; 263 break;
272 default: 264 default: