Skip to content

Commit

Permalink
posix-timers: Fix oops in clock_nanosleep() with CLOCK_MONOTONIC_RAW
Browse files Browse the repository at this point in the history
Prevent calling do_nanosleep() with clockid
CLOCK_MONOTONIC_RAW, it may cause oops, such as NULL pointer
dereference.

Signed-off-by: Hiroshi Shimamoto <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: John Stultz <[email protected]>
Cc: <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
h-shimamoto authored and Ingo Molnar committed Aug 4, 2009
1 parent a33a052 commit 70d715f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions kernel/posix-timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ static int no_timer_create(struct k_itimer *new_timer)
return -EOPNOTSUPP;
}

static int no_nsleep(const clockid_t which_clock, int flags,
struct timespec *tsave, struct timespec __user *rmtp)
{
return -EOPNOTSUPP;
}

/*
* Return nonzero if we know a priori this clockid_t value is bogus.
*/
Expand Down Expand Up @@ -254,6 +260,7 @@ static __init int init_posix_timers(void)
.clock_get = posix_get_monotonic_raw,
.clock_set = do_posix_clock_nosettime,
.timer_create = no_timer_create,
.nsleep = no_nsleep,
};

register_posix_clock(CLOCK_REALTIME, &clock_realtime);
Expand Down

0 comments on commit 70d715f

Please sign in to comment.