Patch "timekeeping: Fix cross-timestamp interpolation on counter wrap" has been added to the 6.1-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

    timekeeping: Fix cross-timestamp interpolation on counter wrap

to the 6.1-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:
     timekeeping-fix-cross-timestamp-interpolation-on-cou.patch
and it can be found in the queue-6.1 subdirectory.

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



commit fe7dc20167ad31b4fc9cf9d4b1ed552a8c5bb6b9
Author: Peter Hilber <peter.hilber@xxxxxxxxxxxxxxx>
Date:   Mon Dec 18 08:38:39 2023 +0100

    timekeeping: Fix cross-timestamp interpolation on counter wrap
    
    [ Upstream commit 84dccadd3e2a3f1a373826ad71e5ced5e76b0c00 ]
    
    cycle_between() decides whether get_device_system_crosststamp() will
    interpolate for older counter readings.
    
    cycle_between() yields wrong results for a counter wrap-around where after
    < before < test, and for the case after < test < before.
    
    Fix the comparison logic.
    
    Fixes: 2c756feb18d9 ("time: Add history to cross timestamp interface supporting slower devices")
    Signed-off-by: Peter Hilber <peter.hilber@xxxxxxxxxxxxxxx>
    Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
    Acked-by: John Stultz <jstultz@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20231218073849.35294-2-peter.hilber@xxxxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 221c8c404973a..c168931c78e01 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1186,7 +1186,7 @@ static bool cycle_between(u64 before, u64 test, u64 after)
 {
 	if (test > before && test < after)
 		return true;
-	if (test < before && before > after)
+	if (before > after && (test > before || test < after))
 		return true;
 	return false;
 }




[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