Skip to content

Commit ad6759f

Browse files
john stultzKAGA-KOKO
authored andcommitted
timekeeping: Prevent oops when GENERIC_TIME=n
Aaro Koskinen reported an issue in kernel.org bugzilla #15366, where on non-GENERIC_TIME systems, accessing /sys/devices/system/clocksource/clocksource0/current_clocksource results in an oops. It seems the timekeeper/clocksource rework missed initializing the curr_clocksource value in the !GENERIC_TIME case. Thanks to Aaro for reporting and diagnosing the issue as well as testing the fix! Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: John Stultz <johnstul@us.ibm.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: stable@kernel.org LKML-Reference: <1267475683.4216.61.camel@localhost.localdomain> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 13dda80 commit ad6759f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎kernel/time/clocksource.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,10 @@ static inline void clocksource_select(void) { }
592592
*/
593593
static int __init clocksource_done_booting(void)
594594
{
595+
mutex_lock(&clocksource_mutex);
596+
curr_clocksource = clocksource_default_clock();
597+
mutex_unlock(&clocksource_mutex);
598+
595599
finished_booting = 1;
596600

597601
/*

0 commit comments

Comments
 (0)