]> git.baikalelectronics.ru Git - kernel.git/commit
hrtimer: Protect lockless access to timer->base
authorJulien Grall <julien.grall@arm.com>
Wed, 21 Aug 2019 09:24:07 +0000 (10:24 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 21 Aug 2019 14:10:01 +0000 (16:10 +0200)
commit2e4885debb09a993545c1b42006886afdb0c8205
tree728574e052504dd97511baa14d8db39b46dd4a3e
parent0ba00a2c67525a3319a8e48ac781bcd34ae2d227
hrtimer: Protect lockless access to timer->base

The update to timer->base is protected by the base->cpu_base->lock().
However, hrtimer_cancel_wait_running() does access it lockless.  So the
compiler is allowed to refetch timer->base which can cause havoc when the
timer base is changed concurrently.

Use READ_ONCE() to prevent this.

[ tglx: Adapted from a RT patch ]

Signed-off-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20190821092409.13225-2-julien.grall@arm.com
kernel/time/hrtimer.c