[Quantal,1/1] UBUNTU: SAUCE: cpuidle: Fix NULL pointer dereference when off-lining CPU's

Message ID 5432ab8845fd85aa102b127e0678d7b2e0078588.1365785549.git.leann.ogasawara@canonical.com
State New
Headers show

Commit Message

Leann Ogasawara April 12, 2013, 5:05 p.m.
From: Leann Ogasawara <leann.ogasawara@canonical.com>

BugLink: http://bugs.launchpad.net/bugs/1168452

When off-lining CPU's on some multi-processor systems (eg. DL385p Gen 8)
we hit a NULL pointer dereference kernel oops.  This is resolved by
checking the device pointer prior to it ever being used.

Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
---
 drivers/cpuidle/cpuidle.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tim Gardner April 12, 2013, 5:42 p.m. | #1

Brad Figg April 12, 2013, 5:45 p.m. | #2
On 04/12/2013 10:05 AM, leann.ogasawara@canonical.com wrote:
> From: Leann Ogasawara <leann.ogasawara@canonical.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/1168452
> 
> When off-lining CPU's on some multi-processor systems (eg. DL385p Gen 8)
> we hit a NULL pointer dereference kernel oops.  This is resolved by
> checking the device pointer prior to it ever being used.
> 
> Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
> ---
>  drivers/cpuidle/cpuidle.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
> index d90519c..dd4816b 100644
> --- a/drivers/cpuidle/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle.c
> @@ -72,7 +72,7 @@ int cpuidle_play_dead(void)
>  	int i, dead_state = -1;
>  	int power_usage = -1;
>  
> -	if (!drv)
> +	if (!drv || !dev)
>  		return -ENODEV;
>  
>  	/* Find lowest-power state that supports long-term idle */
>
Leann Ogasawara April 12, 2013, 5:48 p.m. | #3
Applied to Quantal master-next.

Thanks,
Leann

On 04/12/2013 10:05 AM, leann.ogasawara@canonical.com wrote:
> From: Leann Ogasawara <leann.ogasawara@canonical.com>
>
> BugLink: http://bugs.launchpad.net/bugs/1168452
>
> When off-lining CPU's on some multi-processor systems (eg. DL385p Gen 8)
> we hit a NULL pointer dereference kernel oops.  This is resolved by
> checking the device pointer prior to it ever being used.
>
> Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
> ---
>  drivers/cpuidle/cpuidle.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
> index d90519c..dd4816b 100644
> --- a/drivers/cpuidle/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle.c
> @@ -72,7 +72,7 @@ int cpuidle_play_dead(void)
>  	int i, dead_state = -1;
>  	int power_usage = -1;
>  
> -	if (!drv)
> +	if (!drv || !dev)
>  		return -ENODEV;
>  
>  	/* Find lowest-power state that supports long-term idle */

Patch

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index d90519c..dd4816b 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -72,7 +72,7 @@  int cpuidle_play_dead(void)
 	int i, dead_state = -1;
 	int power_usage = -1;
 
-	if (!drv)
+	if (!drv || !dev)
 		return -ENODEV;
 
 	/* Find lowest-power state that supports long-term idle */