Commit 70d715fd authored by Hiroshi Shimamoto's avatar Hiroshi Shimamoto Committed by Ingo Molnar

posix-timers: Fix oops in clock_nanosleep() with CLOCK_MONOTONIC_RAW

Prevent calling do_nanosleep() with clockid
CLOCK_MONOTONIC_RAW, it may cause oops, such as NULL pointer
dereference.
Signed-off-by: default avatarHiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Stultz <johnstul@us.ibm.com>
Cc: <stable@kernel.org>
LKML-Reference: <4A764FF3.50607@ct.jp.nec.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent a33a052f
...@@ -202,6 +202,12 @@ static int no_timer_create(struct k_itimer *new_timer) ...@@ -202,6 +202,12 @@ static int no_timer_create(struct k_itimer *new_timer)
return -EOPNOTSUPP; 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. * Return nonzero if we know a priori this clockid_t value is bogus.
*/ */
...@@ -254,6 +260,7 @@ static __init int init_posix_timers(void) ...@@ -254,6 +260,7 @@ static __init int init_posix_timers(void)
.clock_get = posix_get_monotonic_raw, .clock_get = posix_get_monotonic_raw,
.clock_set = do_posix_clock_nosettime, .clock_set = do_posix_clock_nosettime,
.timer_create = no_timer_create, .timer_create = no_timer_create,
.nsleep = no_nsleep,
}; };
register_posix_clock(CLOCK_REALTIME, &clock_realtime); register_posix_clock(CLOCK_REALTIME, &clock_realtime);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment