[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-79ef2bb01445400def20c7993b27fbcad27ca95f@git.kernel.org>
Date: Sun, 19 Jul 2009 15:19:00 GMT
From: tip-bot for Thomas Gleixner <tglx@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...hat.com,
error27@...il.com, tglx@...utronix.de
Subject: [tip:timers/urgent] clocksource: Prevent NULL pointer dereference
Commit-ID: 79ef2bb01445400def20c7993b27fbcad27ca95f
Gitweb: http://git.kernel.org/tip/79ef2bb01445400def20c7993b27fbcad27ca95f
Author: Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Sun, 19 Jul 2009 17:09:12 +0200
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitDate: Sun, 19 Jul 2009 17:15:54 +0200
clocksource: Prevent NULL pointer dereference
Writing a zero length string to sys/.../current_clocksource will cause
a NULL pointer dereference if the clock events system is in one shot
(highres or nohz) mode.
Pointed-out-by: Dan Carpenter <error27@...il.com>
LKML-Reference: <alpine.DEB.2.00.0907191545580.12306@...ker>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
---
kernel/time/clocksource.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 592bf58..7466cb8 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -513,7 +513,7 @@ static ssize_t sysfs_override_clocksource(struct sys_device *dev,
* Check to make sure we don't switch to a non-highres capable
* clocksource if the tick code is in oneshot mode (highres or nohz)
*/
- if (tick_oneshot_mode_active() &&
+ if (tick_oneshot_mode_active() && ovr &&
!(ovr->flags & CLOCK_SOURCE_VALID_FOR_HRES)) {
printk(KERN_WARNING "%s clocksource is not HRT compatible. "
"Cannot switch while in HRT/NOHZ mode\n", ovr->name);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists