diff options
author | John Stultz <john.stultz@linaro.org> | 2011-06-01 18:18:09 -0700 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2011-06-21 16:55:36 -0700 |
commit | cb5de2f8d0306be38f9b377b8a5c56acca7dbc3d (patch) | |
tree | 9edd5bd1fd1e41be44026a37b2184200f6f90d50 /kernel/time/timekeeping.c | |
parent | e08f6d4131ab964420f0bcabecc68d75fb49df79 (diff) | |
download | lwn-cb5de2f8d0306be38f9b377b8a5c56acca7dbc3d.tar.gz lwn-cb5de2f8d0306be38f9b377b8a5c56acca7dbc3d.zip |
time: Catch invalid timespec sleep values in __timekeeping_inject_sleeptime
Arve suggested making sure we catch possible negative sleep time
intervals that could be passed into timekeeping_inject_sleeptime.
CC: Arve Hjønnevåg <arve@android.com>
CC: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'kernel/time/timekeeping.c')
-rw-r--r-- | kernel/time/timekeeping.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 342408cf68dd..9d09777a213f 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -604,6 +604,12 @@ static struct timespec timekeeping_suspend_time; */ static void __timekeeping_inject_sleeptime(struct timespec *delta) { + if (!timespec_valid(delta)) { + printk(KERN_WARN "__timekeeping_inject_sleeptime: Invalid " + "sleep delta value!\n"); + return; + } + xtime = timespec_add(xtime, *delta); wall_to_monotonic = timespec_sub(wall_to_monotonic, *delta); total_sleep_time = timespec_add(total_sleep_time, *delta); |