[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240607022614.22902-1-phil.chang@mediatek.com>
Date: Fri, 7 Jun 2024 10:26:14 +0800
From: Phil Chang <phil.chang@...iatek.com>
To: <anna-maria@...utronix.de>
CC: <alix.wu@...iatek.com>, <angelogioacchino.delregno@...labora.com>,
<frederic@...nel.org>, <jy.ho@...iatek.com>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<matthias.bgg@...il.com>, <phil.chang@...iatek.com>, <tglx@...utronix.de>
Subject: [PATCH v2] hrtimer: check hrtimer with a NULL function
Since hrtimers do not allow a NULL function to be passed,
to prevent a kernel crash, return before adding the timer to a queue.
Signed-off-by: Phil Chang <phil.chang@...iatek.com>
---
kernel/time/hrtimer.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 492c14aac642..d32c1afe59b3 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1285,6 +1285,9 @@ void hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
struct hrtimer_clock_base *base;
unsigned long flags;
+ if (WARN_ON(!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
--
2.18.0
Powered by blists - more mailing lists