aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-01-31 13:16:55 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-31 13:16:55 -0500
commit951069e311a2a931bf7c9d838db860f90bf14c45 (patch)
tree0aaeb29c496036983b4e894477f9d9f4881286e1
parent3ee68c4af3fd7228c1be63254b9f884614f9ebb2 (diff)
Don't try to "validate" a non-existing timeval.
settime() with a NULL timeval is silly but legal. Noticed by Dave Jones <davej@redhat.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--kernel/time.c2
-rw-r--r--security/seclvl.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/kernel/time.c b/kernel/time.c
index 7477b1d2079e..1f23e683d6aa 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -155,7 +155,7 @@ int do_sys_settimeofday(struct timespec *tv, struct timezone *tz)
155 static int firsttime = 1; 155 static int firsttime = 1;
156 int error = 0; 156 int error = 0;
157 157
158 if (!timespec_valid(tv)) 158 if (tv && !timespec_valid(tv))
159 return -EINVAL; 159 return -EINVAL;
160 160
161 error = security_settime(tv, tz); 161 error = security_settime(tv, tz);
diff --git a/security/seclvl.c b/security/seclvl.c
index 1caac0164643..8529ea6f7aa8 100644
--- a/security/seclvl.c
+++ b/security/seclvl.c
@@ -368,8 +368,8 @@ static int seclvl_capable(struct task_struct *tsk, int cap)
368 */ 368 */
369static int seclvl_settime(struct timespec *tv, struct timezone *tz) 369static int seclvl_settime(struct timespec *tv, struct timezone *tz)
370{ 370{
371 struct timespec now; 371 if (tv && seclvl > 1) {
372 if (seclvl > 1) { 372 struct timespec now;
373 now = current_kernel_time(); 373 now = current_kernel_time();
374 if (tv->tv_sec < now.tv_sec || 374 if (tv->tv_sec < now.tv_sec ||
375 (tv->tv_sec == now.tv_sec && tv->tv_nsec < now.tv_nsec)) { 375 (tv->tv_sec == now.tv_sec && tv->tv_nsec < now.tv_nsec)) {