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>
This commit is contained in:
parent
e08f6d4131
commit
cb5de2f8d0
|
@ -604,6 +604,12 @@ static struct timespec timekeeping_suspend_time;
|
||||||
*/
|
*/
|
||||||
static void __timekeeping_inject_sleeptime(struct timespec *delta)
|
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);
|
xtime = timespec_add(xtime, *delta);
|
||||||
wall_to_monotonic = timespec_sub(wall_to_monotonic, *delta);
|
wall_to_monotonic = timespec_sub(wall_to_monotonic, *delta);
|
||||||
total_sleep_time = timespec_add(total_sleep_time, *delta);
|
total_sleep_time = timespec_add(total_sleep_time, *delta);
|
||||||
|
|
Loading…
Reference in New Issue