lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <BEC9F67575FA1E429CA7CF5AE9BE363432A46913@SHSMSX104.ccr.corp.intel.com>
Date:   Thu, 4 May 2017 09:00:52 +0000
From:   "Li, Fei" <fei.li@...el.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        "Shi, FengX" <fengx.shi@...el.com>,
        "rjw@...ysocki.net" <rjw@...ysocki.net>,
        "daniel.lezcano@...aro.org" <daniel.lezcano@...aro.org>
CC:     "linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "Koul, Vinod" <vinod.koul@...el.com>
Subject: [PATCH V3] cpuidle: check dev before usage in
 cpuidle_use_deepest_state

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@...el.com>
Tested-by: Shi, Feng <fengx.shi@...el.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Reviewed-by: Koul, Vinod <vinod.koul@...el.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

Best Regards,
Fei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ