summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/time.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/kernel/time.c b/kernel/time.c
index 0b4797fa3d30..52b273c7ccac 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -32,6 +32,8 @@
#include <linux/errno.h>
#include <linux/smp_lock.h>
#include <linux/syscalls.h>
+#include <linux/security.h>
+
#include <asm/uaccess.h>
#include <asm/unistd.h>
@@ -78,13 +80,17 @@ asmlinkage long sys_time(int __user * tloc)
asmlinkage long sys_stime(time_t __user *tptr)
{
struct timespec tv;
+ int err;
- if (!capable(CAP_SYS_TIME))
- return -EPERM;
if (get_user(tv.tv_sec, tptr))
return -EFAULT;
tv.tv_nsec = 0;
+
+ err = security_settime(&tv, NULL);
+ if (err)
+ return err;
+
do_settimeofday(&tv);
return 0;
}
@@ -146,10 +152,12 @@ inline static void warp_clock(void)
int do_sys_settimeofday(struct timespec *tv, struct timezone *tz)
{
static int firsttime = 1;
+ int error = 0;
+
+ error = security_settime(tv, tz);
+ if (error)
+ return error;
- if (!capable(CAP_SYS_TIME))
- return -EPERM;
-
if (tz) {
/* SMP safe, global irq locking makes it work. */
sys_tz = *tz;