diff mbox

[3.11.y.z,extended,stable] Patch "cpuidle: Check the result of cpuidle_get_driver() against NULL" has been added to staging queue

Message ID 32E05991AD97534A81A86422CF4956F2238CE1A9@HKMAIL01.nvidia.com
State New
Headers show

Commit Message

Daniel Fu April 11, 2014, 4:51 p.m. UTC
It's great. I am fine with it.

Thanks.
Daniel

-----Original Message-----
From: Luis Henriques [mailto:luis.henriques@canonical.com] 
Sent: Friday, April 11, 2014 4:00 AM
To: Daniel Fu
Cc: Rafael J. Wysocki; Mark Brown; Luis Henriques; kernel-team@lists.ubuntu.com
Subject: [3.11.y.z extended stable] Patch "cpuidle: Check the result of cpuidle_get_driver() against NULL" has been added to staging queue

This is a note to let you know that I have just added a patch titled

    cpuidle: Check the result of cpuidle_get_driver() against NULL

to the linux-3.11.y-queue branch of the 3.11.y.z extended stable tree which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.11.y-queue

If you, or anyone else, feels it should not be added to this tree, please reply to this email.

For more information about the 3.11.y.z tree, see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

From 77092523a3e51fd593d04bcfe72ac19ca8deb6ae Mon Sep 17 00:00:00 2001
From: Daniel Fu <danifu@nvidia.com>
Date: Fri, 30 Aug 2013 19:48:22 +0800
Subject: cpuidle: Check the result of cpuidle_get_driver() against NULL

commit 3b9c10e98021e1f92e6f8c7ce1778b86ba68db10 upstream.

If the current CPU has no cpuidle driver, drv will be NULL in cpuidle_driver_ref().  Check if that is the case before trying to bump up the driver's refcount to prevent the kernel from crashing.

[rjw: Subject and changelog]
Signed-off-by: Daniel Fu <danifu@nvidia.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/cpuidle/driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
1.9.1

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
diff mbox

Patch

diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c index 3ac499d..6e11701 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -331,7 +331,8 @@  struct cpuidle_driver *cpuidle_driver_ref(void)
 	spin_lock(&cpuidle_driver_lock);

 	drv = cpuidle_get_driver();
-	drv->refcnt++;
+	if (drv)
+		drv->refcnt++;

 	spin_unlock(&cpuidle_driver_lock);
 	return drv;