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-prev] [day] [month] [year] [list]
Date:	Thu, 16 Aug 2012 22:19:32 +0200
From:	"Rafael J. Wysocki" <rjw@...k.pl>
To:	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Cc:	lenb@...nel.org, linux-pm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] intel_idle: Check cpu_idle_get_driver() for NULL before dereferencing it.

On Monday, August 06, 2012, Konrad Rzeszutek Wilk wrote:
> On Sat, Aug 04, 2012 at 11:56:35PM +0200, Rafael J. Wysocki wrote:
> > On Thursday, August 02, 2012, Konrad Rzeszutek Wilk wrote:
> > > If the machine is booted without any cpu_idle driver set
> > > (b/c disable_cpuidle() has been called) we should follow
> > > other users of cpu_idle API and check the return value
> > > for NULL before using it.
> > > 
> > > Reported-by: Mark van Dijk <mark@...ernecto.net>
> > > Tested-by: Mark van Dijk <mark@...ernecto.net>
> > > Suggested-by: Jan Beulich <JBeulich@...e.com>
> > > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
> > > ---
> > >  drivers/idle/intel_idle.c |    2 +-
> > >  1 files changed, 1 insertions(+), 1 deletions(-)
> > > 
> > > diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
> > > index f559088..7383aa0 100644
> > > --- a/drivers/idle/intel_idle.c
> > > +++ b/drivers/idle/intel_idle.c
> > > @@ -607,7 +607,7 @@ static int __init intel_idle_init(void)
> > >  	retval = cpuidle_register_driver(&intel_idle_driver);
> > >  	if (retval) {
> > 
> > What about:
> > 
> >   		struct cpuidle_driver *drv = cpuidle_get_driver();
> > 
> >   		printk(KERN_DEBUG PREFIX "intel_idle yielding to %s",
> > 			drv ? drv->name : "none");
> > 
> > >  		printk(KERN_DEBUG PREFIX "intel_idle yielding to %s",
> > > -			cpuidle_get_driver()->name);
> > > +			cpuidle_get_driver() ? cpuidle_get_driver()->name : "none");
> > >  		return retval;
> > >  	}
> > >  
> > > 
> > 
> > Rafael
> 
> Here it is:
> 
> From a8b7aa06cacb5f42a90a0d4a0a1a95e230d43fc6 Mon Sep 17 00:00:00 2001
> From: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
> Date: Thu, 2 Aug 2012 10:31:52 -0400
> Subject: [PATCH] intel_idle: Check cpu_idle_get_driver() for NULL before
>  dereferencing it.
> 
> If the machine is booted without any cpu_idle driver set
> (b/c disable_cpuidle() has been called) we should follow
> other users of cpu_idle API and check the return value
> for NULL before using it.
> 
> Reported-by: Mark van Dijk <mark@...ernecto.net>
> Tested-by: Mark van Dijk <mark@...ernecto.net>
> Suggested-by: Jan Beulich <JBeulich@...e.com>
> [v1: Redo per Rafael's suggestion]
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>

Applied to the linux-next branch of the linux-pm.git tree as v3.6 material.

Thanks,
Rafael


> ---
>  drivers/idle/intel_idle.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
> index d0f59c3..6b313af 100644
> --- a/drivers/idle/intel_idle.c
> +++ b/drivers/idle/intel_idle.c
> @@ -556,8 +556,9 @@ static int __init intel_idle_init(void)
>  	intel_idle_cpuidle_driver_init();
>  	retval = cpuidle_register_driver(&intel_idle_driver);
>  	if (retval) {
> +		struct cpuidle_driver *drv = cpuidle_get_driver();
>  		printk(KERN_DEBUG PREFIX "intel_idle yielding to %s",
> -			cpuidle_get_driver()->name);
> +			drv ? drv->name : "none");
>  		return retval;
>  	}
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ