Patch "hrtimer: Prevent queuing of hrtimer without a function callback" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    hrtimer: Prevent queuing of hrtimer without a function callback

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     hrtimer-prevent-queuing-of-hrtimer-without-a-functio.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7b9338c2538f5eda6d653f303f9c5c4258be2d23
Author: Phil Chang <phil.chang@xxxxxxxxxxxx>
Date:   Mon Jun 10 21:31:36 2024 +0800

    hrtimer: Prevent queuing of hrtimer without a function callback
    
    [ Upstream commit 5a830bbce3af16833fe0092dec47b6dd30279825 ]
    
    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@xxxxxxxxxxxx>
    Signed-off-by: Anna-Maria Behnsen <anna-maria@xxxxxxxxxxxxx>
    Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
    Reviewed-by: Anna-Maria Behnsen <anna-maria@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 2b2a6e29219dc..16f1e747c5673 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1182,6 +1182,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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux