]> git.baikalelectronics.ru Git - kernel.git/commit
hrtimer: Catch invalid clockids again
authorMarc Zyngier <marc.zyngier@arm.com>
Fri, 15 Jan 2016 17:41:09 +0000 (17:41 +0000)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 18 Feb 2017 09:58:39 +0000 (10:58 +0100)
commit6a61ad8855ee3928ae050c526c36bd98bc098cd0
tree6b987abecbe65d4ed1dcd3a9d5ad4e2215b4bac8
parente2d3c5c61f084fa9767f068e3c3930f9c28d0ced
hrtimer: Catch invalid clockids again

commit dc068acaa005 ("hrtimer: Revert CLOCK_MONOTONIC_RAW support") removed
unfortunately a sanity check in the hrtimer code which was part of that
MONOTONIC_RAW patch series.

It would have caught the bogus usage of CLOCK_MONOTONIC_RAW in the wireless
code. So bring it back.

It is way too easy to take any random clockid and feed it to the hrtimer
subsystem. At best, it gets mapped to a monotonic base, but it would be
better to just catch illegal values as early as possible.

Detect invalid clockids, map them to CLOCK_MONOTONIC and emit a warning.

[ tglx: Replaced the BUG by a WARN and gracefully map to CLOCK_MONOTONIC ]

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: Tomasz Nowicki <tn@semihalf.com>
Cc: Christoffer Dall <christoffer.dall@linaro.org>
Link: http://lkml.kernel.org/r/1452879670-16133-3-git-send-email-marc.zyngier@arm.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
kernel/time/hrtimer.c