mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-21 01:51:18 +00:00
hrtimer: Prevent queuing of hrtimer without a function callback
[ Upstream commit 5a830bbce3
]
The hrtimer function callback must not be NULL. It has to be specified by
the call side but it is not validated by the hrtimer code. When a hrtimer
is queued without a function callback, the kernel crashes with a null
pointer dereference when trying to execute the callback in __run_hrtimer().
Introduce a validation before queuing the hrtimer in
hrtimer_start_range_ns().
[anna-maria: Rephrase commit message]
Signed-off-by: Phil Chang <phil.chang@mediatek.com>
Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
3cc03d1dbd
commit
a855d12979
1 changed files with 2 additions and 0 deletions
|
@ -1288,6 +1288,8 @@ void hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
|
|||
struct hrtimer_clock_base *base;
|
||||
unsigned long flags;
|
||||
|
||||
if (WARN_ON_ONCE(!timer->function))
|
||||
return;
|
||||
/*
|
||||
* Check whether the HRTIMER_MODE_SOFT bit and hrtimer.is_soft
|
||||
* match on CONFIG_PREEMPT_RT = n. With PREEMPT_RT check the hard
|
||||
|
|
Loading…
Reference in a new issue