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:	Wed, 15 Aug 2012 22:23:17 +0200
From:	"Rafael J. Wysocki" <rjw@...k.pl>
To:	"Jon Medhurst (Tixy)" <tixy@...aro.org>
Cc:	linux-kernel@...r.kernel.org, Colin Cross <ccross@...roid.com>,
	Len Brown <len.brown@...el.com>,
	linux-pm@...ts.linux-foundation.org,
	linux-arm-kernel@...ts.infradead.org, Len Brown <lenb@...nel.org>
Subject: Re: [PATCH] cpuidle: Prevent null pointer dereference in cpuidle_coupled_cpu_notify

On Tuesday, August 14, 2012, Jon Medhurst (Tixy) wrote:
> When a kernel is built to support multiple hardware types it's possible
> that CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is set but the hardware the
> kernel is run on doesn't support cpuidle and therefore doesn't load a
> driver for it. In this case, when the system is shut down,
> cpuidle_coupled_cpu_notify() gets called with cpuidle_devices set to
> NULL. There are quite possibly other circumstances where this
> situation can also occur and we should check for it.
> 
> Signed-off-by: Jon Medhurst <tixy@...aro.org>

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

Thanks,
Rafael


> ---
> 
> Would a better fix be to delay registering the notifier until
> cpuidle_coupled_register_device() is called? Though following through
> with that logic would require unregistering the notifier when cpuidle
> driver is unregistered and it still seems possible that there would
> still be a window of opportunity for things to go wrong.
> 
> 
>  drivers/cpuidle/coupled.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c
> index 2c9bf26..c78a5ff 100644
> --- a/drivers/cpuidle/coupled.c
> +++ b/drivers/cpuidle/coupled.c
> @@ -681,7 +681,7 @@ static int cpuidle_coupled_cpu_notify(struct notifier_block *nb,
>  	mutex_lock(&cpuidle_lock);
>  
>  	dev = per_cpu(cpuidle_devices, cpu);
> -	if (!dev->coupled)
> +	if (!dev || !dev->coupled)
>  		goto out;
>  
>  	switch (action & ~CPU_TASKS_FROZEN) {
> 

--
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