mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pingbo Wen <pingbo.wen@linaro.org>
To: eas-dev@lists.linaro.org
Cc: mturquette@baylibre.com, smuckle@linaro.org,
	linux-kernel@vger.kernel.org, Pingbo Wen <pingbo.wen@linaro.org>
Subject: [PATCH] cpufreq_sched: set governor_data before waking up kschedfreq
Date: Sat, 20 Feb 2016 19:32:46 +0800	[thread overview]
Message-ID: <1455967966-11911-1-git-send-email-pingbo.wen@linaro.org> (raw)

Fix null pointer dereference error liked below. This BUG can be easily
re-produced by 'monkey --throttle 50' in android 6.0.

Unable to handle kernel NULL pointer dereference at virtual address 00000010
[KERN Warning] check backtrace:
CPU: 0 PID: 10714 Comm: kschedfreq:0 Tainted:
Call trace:
[<ffffffc00008b8ac>] dump_backtrace+0x0/0x15c
[<ffffffc00008ba18>] show_stack+0x10/0x1c
[<ffffffc000b97bf8>] dump_stack+0x74/0xb8
[<ffffffc00036208c>] debug_locks_off+0x4c/0x7c
[<ffffffc0000a3450>] oops_enter+0xc/0x28
[<ffffffc00008ba50>] die+0x2c/0x1a4
[<ffffffc000b96588>] __do_kernel_fault.part.5+0x70/0x84
[<ffffffc00009c728>] do_page_fault+0x344/0x348
[<ffffffc00009c7e8>] do_translation_fault+0xbc/0xf0
[<ffffffc0000822b0>] do_mem_abort+0x38/0x9c
[<ffffffc000085c50>] el1_da+0x14/0x80
[<ffffffc0000c0168>] kthread+0xd4/0xec

Signed-off-by: Pingbo Wen <pingbo.wen@linaro.org>
---
 kernel/sched/cpufreq_sched.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/cpufreq_sched.c b/kernel/sched/cpufreq_sched.c
index e1d208e..93731ef 100644
--- a/kernel/sched/cpufreq_sched.c
+++ b/kernel/sched/cpufreq_sched.c
@@ -265,6 +265,8 @@ static int cpufreq_sched_policy_init(struct cpufreq_policy *policy)
 	pr_debug("%s: throttle threshold = %u [ns]\n",
 		  __func__, gd->throttle_nsec);
 
+	policy->governor_data = gd;
+
 	if (cpufreq_driver_is_slow()) {
 		cpufreq_driver_slow = true;
 		gd->task = kthread_create(cpufreq_sched_thread, policy,
@@ -281,7 +283,6 @@ static int cpufreq_sched_policy_init(struct cpufreq_policy *policy)
 		init_irq_work(&gd->irq_work, cpufreq_sched_irq_work);
 	}
 
-	policy->governor_data = gd;
 	set_sched_freq();
 
 	return 0;
-- 
1.9.1

             reply	other threads:[~2016-02-20 11:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-20 11:32 Pingbo Wen [this message]
2016-02-22 10:53 ` [Eas-dev] " Juri Lelli
2016-02-22 11:32   ` Pingbo Wen
2016-02-22 11:42     ` Juri Lelli

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=1455967966-11911-1-git-send-email-pingbo.wen@linaro.org \
    --to=pingbo.wen@linaro.org \
    --cc=eas-dev@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=smuckle@linaro.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 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®