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>
This commit is contained in:
Linus Torvalds
2006-01-31 10:16:55 -08:00
parent 3ee68c4af3
commit 951069e311
2 changed files with 3 additions and 3 deletions

View File

@@ -155,7 +155,7 @@ int do_sys_settimeofday(struct timespec *tv, struct timezone *tz)
static int firsttime = 1; static int firsttime = 1;
int error = 0; int error = 0;
if (!timespec_valid(tv)) if (tv && !timespec_valid(tv))
return -EINVAL; return -EINVAL;
error = security_settime(tv, tz); error = security_settime(tv, tz);

View File

@@ -368,8 +368,8 @@ static int seclvl_capable(struct task_struct *tsk, int cap)
*/ */
static int seclvl_settime(struct timespec *tv, struct timezone *tz) static int seclvl_settime(struct timespec *tv, struct timezone *tz)
{ {
struct timespec now; if (tv && seclvl > 1) {
if (seclvl > 1) { struct timespec now;
now = current_kernel_time(); now = current_kernel_time();
if (tv->tv_sec < now.tv_sec || if (tv->tv_sec < now.tv_sec ||
(tv->tv_sec == now.tv_sec && tv->tv_nsec < now.tv_nsec)) { (tv->tv_sec == now.tv_sec && tv->tv_nsec < now.tv_nsec)) {