From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: "Li, Fei" <fei.li@intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
"Shi, FengX" <fengx.shi@intel.com>,
"daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Koul, Vinod" <vinod.koul@intel.com>
Subject: Re: [PATCH V3] cpuidle: check dev before usage in cpuidle_use_deepest_state
Date: Fri, 05 May 2017 23:33:08 +0200 [thread overview]
Message-ID: <3249200.sUIrOijesG@aspire.rjw.lan> (raw)
In-Reply-To: <BEC9F67575FA1E429CA7CF5AE9BE363432A46913@SHSMSX104.ccr.corp.intel.com>
On Thursday, May 04, 2017 09:00:52 AM Li, Fei wrote:
> In case of there is no cpuidle devices registered, dev will be null, and
> panic will be triggered like below;
> In this patch, add checking of dev before usage, like that done in
> cpuidle_idle_call.
>
> Panic without fix:
> [ 184.961328] BUG: unable to handle kernel NULL pointer dereference at
> (null)
> [ 184.961328] IP: cpuidle_use_deepest_state+0x30/0x60
> ...
> [ 184.961328] play_idle+0x8d/0x210
> [ 184.961328] ? __schedule+0x359/0x8e0
> [ 184.961328] ? _raw_spin_unlock_irqrestore+0x28/0x50
> [ 184.961328] ? kthread_queue_delayed_work+0x41/0x80
> [ 184.961328] clamp_idle_injection_func+0x64/0x1e0
>
> Fixes: bb8313b603eb8 ("cpuidle: Allow enforcing deepest idle state selection")
> Signed-off-by: Li, Fei <fei.li@intel.com>
> Tested-by: Shi, Feng <fengx.shi@intel.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Reviewed-by: Koul, Vinod <vinod.koul@intel.com>
> ---
> drivers/cpuidle/cpuidle.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
> index 548b90b..2706be7 100644
> --- a/drivers/cpuidle/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle.c
> @@ -111,7 +111,8 @@ void cpuidle_use_deepest_state(bool enable)
>
> preempt_disable();
> dev = cpuidle_get_device();
> - dev->use_deepest_state = enable;
> + if (dev)
> + dev->use_deepest_state = enable;
> preempt_enable();
> }
>
> --
> 1.9.1
A previous version of this has been applied and I don't see any differences
in the code changes.
Thanks,
Rafael
next prev parent reply other threads:[~2017-05-05 21:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-04 9:00 Li, Fei
2017-05-04 10:16 ` Daniel Lezcano
2017-05-05 1:53 ` Li, Fei
2017-05-05 21:33 ` Rafael J. Wysocki [this message]
2017-05-05 22:21 ` Andy Shevchenko
2017-05-08 0:52 ` Li, Fei
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=3249200.sUIrOijesG@aspire.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=andriy.shevchenko@linux.intel.com \
--cc=daniel.lezcano@linaro.org \
--cc=fei.li@intel.com \
--cc=fengx.shi@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=vinod.koul@intel.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
all inboxes | Powered by JetHome®