mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Thomas Gleixner <tglx@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	error27@gmail.com, tglx@linutronix.de
Subject: [tip:timers/urgent] clocksource: Prevent NULL pointer dereference
Date: Sun, 19 Jul 2009 15:19:00 GMT	[thread overview]
Message-ID: <tip-79ef2bb01445400def20c7993b27fbcad27ca95f@git.kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.00.0907191545580.12306@bicker>

Commit-ID:  79ef2bb01445400def20c7993b27fbcad27ca95f
Gitweb:     http://git.kernel.org/tip/79ef2bb01445400def20c7993b27fbcad27ca95f
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sun, 19 Jul 2009 17:09:12 +0200
Committer:  Thomas Gleixner <tglx@linutronix.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@gmail.com>
LKML-Reference: <alpine.DEB.2.00.0907191545580.12306@bicker>
Signed-off-by: Thomas Gleixner <tglx@linutronix.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);

      parent reply	other threads:[~2009-07-19 15:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-19 13:04 potential null dereference in sysfs_override_clocksource() Dan Carpenter
2009-07-19 15:12 ` Thomas Gleixner
2009-07-19 15:19 ` tip-bot for Thomas Gleixner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-79ef2bb01445400def20c7993b27fbcad27ca95f@git.kernel.org \
    --to=tglx@linutronix.de \
    --cc=error27@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome