David Engraf
51fd36f3fa
hrtimer: Fix ktime_add_ns() overflow on 32bit architectures
...
One can trigger an overflow when using ktime_add_ns() on a 32bit
architecture not supporting CONFIG_KTIME_SCALAR.
When passing a very high value for u64 nsec, e.g. 7881299347898368000
the do_div() function converts this value to seconds (7881299347) which
is still to high to pass to the ktime_set() function as long. The result
in is a negative value.
The problem on my system occurs in the tick-sched.c,
tick_nohz_stop_sched_tick() when time_delta is set to
timekeeping_max_deferment(). The check for time_delta < KTIME_MAX is
valid, thus ktime_add_ns() is called with a too large value resulting in
a negative expire value. This leads to an endless loop in the ticker code:
time_delta: 7881299347898368000
expires = ktime_add_ns(last_update, time_delta)
expires: negative value
This fix caps the value to KTIME_MAX.
This error doesn't occurs on 64bit or architectures supporting
CONFIG_KTIME_SCALAR (e.g. ARM, x86-32).
Cc: stable@vger.kernel.org
Signed-off-by: David Engraf <david.engraf@sysgo.com >
[jstultz: Minor tweaks to commit message & header]
Signed-off-by: John Stultz <john.stultz@linaro.org >
2013-04-08 13:21:20 -07:00
..
2013-03-02 08:31:39 -08:00
2013-02-27 19:10:24 -08:00
2013-01-11 11:39:33 -08:00
2013-02-26 20:16:07 -08:00
2013-02-21 12:05:51 -08:00
2013-02-28 12:52:24 -08:00
2013-04-04 13:18:32 -07:00
2013-03-11 07:54:29 -07:00
2013-02-26 20:16:07 -08:00
2013-02-19 22:01:33 -08:00
2013-01-11 14:54:55 -08:00
2013-01-11 14:54:55 -08:00
2013-01-11 14:54:56 -08:00
2012-10-12 00:32:02 -04:00
2013-01-10 14:35:23 -08:00
2013-01-11 14:54:55 -08:00
2012-05-15 14:59:24 -07:00
2012-11-19 08:13:38 -08:00
2013-02-27 19:10:24 -08:00
2013-02-23 18:50:11 -08:00
2011-07-25 20:57:15 -07:00
2013-02-19 18:19:48 -08:00
2012-05-31 17:49:27 -07:00
2013-02-19 19:04:55 -08:00
2013-02-20 09:18:31 -08:00
2011-11-06 19:44:47 -08:00
2012-12-18 10:55:28 -08:00
2013-01-27 19:23:31 +01:00
2012-03-28 18:30:03 +01:00
2013-02-27 19:10:11 -08:00
2012-04-19 15:06:55 -07:00
2013-02-27 19:10:12 -08:00
2012-10-26 14:27:49 -07:00
2013-02-23 18:50:11 -08:00
2013-02-27 16:59:05 -05:00
2012-05-03 03:29:33 -07:00
2013-04-08 13:21:20 -07:00
2012-04-25 12:39:25 +02:00
2013-02-05 00:48:46 +01:00
2012-04-10 11:00:30 +02:00
2012-08-06 19:00:35 +03:00
2012-05-29 16:22:32 -07:00
2012-12-20 17:40:19 -08:00
2012-09-13 17:56:13 +02:00
2012-03-23 13:18:57 +01:00
2013-02-27 19:10:12 -08:00
2013-01-23 09:31:01 -08:00
2013-02-27 19:10:24 -08:00
2012-12-11 18:10:49 -08:00
2012-12-12 17:38:33 -08:00
2011-10-31 09:20:12 -04:00
2012-05-29 23:28:41 -04:00
2012-10-24 12:39:09 +02:00
2013-02-27 19:10:11 -08:00
2013-02-27 20:58:09 -08:00
2012-12-14 13:06:44 +10:30
2012-12-20 17:40:21 -08:00
2012-12-05 11:27:24 +10:30
2012-10-19 17:30:40 -07:00
2013-02-26 20:16:07 -08:00
2011-10-31 09:20:12 -04:00
2013-02-07 20:51:08 +01:00
2011-10-31 09:20:12 -04:00
2013-02-26 20:16:07 -08:00
2012-12-06 17:16:23 +08:00
2013-01-21 17:17:57 +10:30
2012-05-04 17:28:18 -07:00
2012-12-25 16:10:05 -08:00
2013-02-27 19:10:24 -08:00
2013-02-19 19:05:45 -08:00
2013-03-22 16:19:59 -07:00
2013-02-25 16:46:44 -08:00
2013-01-24 15:37:26 +01:00
2013-02-08 17:47:13 +01:00
2011-10-31 09:20:11 -04:00
2013-01-28 22:06:21 -08:00
2013-01-28 22:25:21 -08:00
2013-01-28 22:06:21 -08:00
2013-01-28 22:25:21 -08:00
2013-02-04 12:18:20 -08:00
2013-01-08 14:12:19 -08:00
2012-11-16 10:05:57 -08:00
2013-01-28 22:25:21 -08:00
2013-01-28 22:25:21 -08:00
2013-02-22 23:31:31 -05:00
2012-12-18 15:02:12 -08:00
2012-10-06 03:05:31 +09:00
2013-02-07 20:51:08 +01:00
2013-02-07 20:51:08 +01:00
2013-02-07 20:51:08 +01:00
2013-01-11 14:54:55 -08:00
2012-10-02 21:14:29 +10:00
2012-04-05 17:15:55 -07:00
2013-03-02 19:32:06 -08:00
2013-02-21 17:22:20 -08:00
2013-03-08 15:05:34 -08:00
2012-08-13 17:01:07 +02:00
2013-03-05 18:10:04 -08:00
2012-03-23 13:18:57 +01:00
2013-02-07 15:19:36 -08:00
2011-10-31 09:20:12 -04:00
2013-02-26 22:25:17 +01:00
2012-12-14 13:05:22 +10:30
2013-02-27 19:10:09 -08:00
2013-02-27 19:10:21 -08:00
2013-03-02 07:58:56 -08:00
2012-09-13 16:47:34 +02:00
2012-10-06 03:05:31 +09:00
2013-03-15 16:50:20 -07:00
2013-02-16 23:17:25 +01:00
2013-02-19 18:19:48 -08:00
2013-02-27 19:10:24 -08:00
2013-01-27 19:23:31 +01:00
2012-05-03 03:28:41 -07:00
2011-10-31 09:20:12 -04:00
2013-01-26 22:12:04 -08:00
2013-02-27 19:10:24 -08:00
2013-02-27 19:10:24 -08:00
2013-02-27 19:10:22 -08:00
2013-02-27 19:10:22 -08:00
2012-12-06 10:39:54 +01:00
2013-02-22 19:25:09 -08:00
2013-02-13 19:29:12 -08:00
2013-02-27 19:10:24 -08:00