All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] posix-timers: fix oops in clock_nanosleep() with CLOCK_MONOTONIC_RAW
@ 2009-08-03  2:48 Hiroshi Shimamoto
  2009-08-04  7:22 ` Andrew Morton
  2009-08-04  8:21 ` [tip:timers/urgent] posix-timers: Fix " tip-bot for Hiroshi Shimamoto
  0 siblings, 2 replies; 6+ messages in thread
From: Hiroshi Shimamoto @ 2009-08-03  2:48 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Ingo Molnar, linux-kernel

From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>

Prevent calling do_nanosleep() with clockid CLOCK_MONOTONIC_RAW, it may
cause oops, such as NULL pointer dereference.

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
---
 kernel/posix-timers.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 052ec4d..d089d05 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -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.
  */
@@ -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);
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-08-04  8:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-03  2:48 [PATCH] posix-timers: fix oops in clock_nanosleep() with CLOCK_MONOTONIC_RAW Hiroshi Shimamoto
2009-08-04  7:22 ` Andrew Morton
2009-08-04  7:41   ` Hiroshi Shimamoto
2009-08-04  7:57     ` Andrew Morton
2009-08-04  8:06       ` Hiroshi Shimamoto
2009-08-04  8:21 ` [tip:timers/urgent] posix-timers: Fix " tip-bot for Hiroshi Shimamoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.