All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhang, Rui" <rui.zhang@intel.com>
To: Andreas Mohr <andi@lisas.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [ASAP] thermal_sys.c NULL ptr deref patch likely incomplete
Date: Fri, 15 Feb 2013 09:56:18 +0000	[thread overview]
Message-ID: <744357E9AAD1214791ACBA4B0B90926329ED84@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <20130214144404.GA20011@rhlx01.hs-esslingen.de>

[-- Attachment #1: Type: text/plain, Size: 1452 bytes --]



> -----Original Message-----
> From: Andreas Mohr [mailto:andi@lisas.de]
> Sent: Thursday, February 14, 2013 10:44 PM
> To: Zhang, Rui
> Cc: linux-kernel@vger.kernel.org
> Subject: [ASAP] thermal_sys.c NULL ptr deref patch likely incomplete
> Importance: High
> 
> Hi,
> 
> I just had a
> 
> # cat /sys/class/thermal/thermal_zone0/policy
> (null)
> 
> 
> When looking at the code (on my -rc7), I saw:
> 
> drivers/thermal/thermal_sys.c
> 
> static ssize_t
> policy_show(struct device *dev, struct device_attribute *devattr, char
> *buf)
> {
>         struct thermal_zone_device *tz = to_thermal_zone(dev);
> 
>         return sprintf(buf, "%s\n", tz->governor->name);
> }
> 
> 
> (not sure though why I manage to get a "(null)" rather than a crash
> due to the dereferencing prior to output - possibly since I do have a
> valid governor allocated yet then only its name field is null?)
> 
Hmm,

Please apply the debug patch and see what you can get here.

Thanks,
rui
> 
> Seems we are missing a critical (and -rc-relevant) patch here
> (and perhaps at other locations in this file, too, given that
> this one was missed last time?).
> 
> Currently trying to get acerhdf operation into a working state
> (and having some trouble with it - didn't know that I probably need
> some
> governor setup which seems to have just been available on my last setup,
> or so)
> 
> Thanks,
> 
> Andreas Mohr

[-- Attachment #2: acerhdf-debug-2.patch --]
[-- Type: application/octet-stream, Size: 618 bytes --]

diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index 8c8ce80..57c83aa 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -697,7 +697,9 @@ policy_show(struct device *dev, struct device_attribute *devattr, char *buf)
 {
 	struct thermal_zone_device *tz = to_thermal_zone(dev);
 
-	return sprintf(buf, "%s\n", tz->governor->name);
+	return sprintf(buf, "%s\n", tz->governor ? (tz->governor->name ? tz->governor->name : "NULL name") : "NULL governor");
+
+//	return sprintf(buf, "%s\n", tz->governor->name);
 }
 
 static DEVICE_ATTR(type, 0444, type_show, NULL);

  parent reply	other threads:[~2013-02-15  9:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-14 14:44 [ASAP] thermal_sys.c NULL ptr deref patch likely incomplete Andreas Mohr
2013-02-15  8:34 ` Zhang, Rui
2013-02-15 16:25   ` Andreas Mohr
2013-02-15  9:56 ` Zhang, Rui [this message]
2013-02-18 11:48 ` Zhang, Rui

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=744357E9AAD1214791ACBA4B0B90926329ED84@SHSMSX101.ccr.corp.intel.com \
    --to=rui.zhang@intel.com \
    --cc=andi@lisas.de \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.