hrtimer: Prevent queuing of hrtimer without a function callback
authorPhil Chang <phil.chang@mediatek.com>
Mon, 10 Jun 2024 13:31:36 +0000 (21:31 +0800)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 25 Jun 2024 14:54:27 +0000 (16:54 +0200)
commit5a830bbce3af16833fe0092dec47b6dd30279825
treeee5a404961727f31232b29208f03e5b96c30e76d
parent6ba59ff4227927d3a8530fc2973b80e94b54d58f
hrtimer: Prevent queuing of hrtimer without a function callback

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>
kernel/time/hrtimer.c