[tip:timers/urgent] timekeeping: Prevent oops when GENERIC_TIME=n

From: tip-bot for john stultz
Date: Tue Mar 02 2010 - 03:25:22 EST


Commit-ID: ad6759fbf35d104dbf573cd6f4c6784ad6823f7e
Gitweb: http://git.kernel.org/tip/ad6759fbf35d104dbf573cd6f4c6784ad6823f7e
Author: john stultz <johnstul@xxxxxxxxxx>
AuthorDate: Mon, 1 Mar 2010 12:34:43 -0800
Committer: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
CommitDate: Tue, 2 Mar 2010 09:22:25 +0100

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@xxxxxx>
Signed-off-by: John Stultz <johnstul@xxxxxxxxxx>
Cc: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
Cc: stable@xxxxxxxxxx
LKML-Reference: <1267475683.4216.61.camel@xxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>

---
kernel/time/clocksource.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 1f663d2..1f5dde6 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -592,6 +592,10 @@ static inline void clocksource_select(void) { }
*/
static int __init clocksource_done_booting(void)
{
+ mutex_lock(&clocksource_mutex);
+ curr_clocksource = clocksource_default_clock();
+ mutex_unlock(&clocksource_mutex);
+
finished_booting = 1;

/*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/