From: Bryan Kadzban Date: Tue, 16 Oct 2007 08:28:23 +0000 (-0700) Subject: rtc: allow validated RTC_PIE_ON for non-root X-Git-Tag: firefly_0821_release~25577 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9d013d3b14f4c81bdfe6c81fc506037d60007036;p=firefly-linux-kernel-4.4.55.git rtc: allow validated RTC_PIE_ON for non-root drivers/char/rtc.c allowed RTC_PIE_ON ioctls for non-root users, as long as the current interval (set via RTC_IRQP_SET) is <= max_user_freq. Allow RTC_PIE_ON under the same conditions when /dev/rtc* is handled by the rtc subsystem. Signed-off-by: Bryan Kadzban Acked-by: Alessandro Zummo Cc: David Brownell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 87d4add6b7f6..814583bd2fe7 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c @@ -233,7 +233,8 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, break; case RTC_PIE_ON: - if (!capable(CAP_SYS_RESOURCE)) + if (rtc->irq_freq > rtc->max_user_freq && + !capable(CAP_SYS_RESOURCE)) return -EACCES; break; }