linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] acpi-cpufreq: De-register cpu notifier and free struct msr on error.
@ 2014-01-28  3:58 Konrad Rzeszutek Wilk
  2014-01-28  9:41 ` Lukasz Majewski
  2014-02-03  6:22 ` Viresh Kumar
  0 siblings, 2 replies; 3+ messages in thread
From: Konrad Rzeszutek Wilk @ 2014-01-28  3:58 UTC (permalink / raw)
  To: linux-kernel, rafael.j.wysocki, cpufreq, linux-pm
  Cc: Konrad Rzeszutek Wilk, Lukasz Majewski, Myungjoo Ham,
	Viresh Kumar, Boris Ostrovsky

If cpufreq_register_driver() fails we would free the acpi driver
related structures but not free the ones allocated
by acpi_cpufreq_boost_init() function. This meant that as
the driver error-ed out and a CPU online/offline event came
we would crash and burn as one of the CPU notifiers would point
to garbage.

This fixes a regression that commit cfc9c8ed03e4d908f2388af8815f44c87b503aaf
"acpi-cpufreq: Adjust the code to use the common boost attribute"
introduced.

CC: Lukasz Majewski <l.majewski@samsung.com>
CC: Myungjoo Ham <myungjoo.ham@samsung.com>
CC: Viresh Kumar <viresh.kumar@linaro.org>
CC: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/cpufreq/acpi-cpufreq.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 79e5608..3e856d6 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -969,9 +969,10 @@ static int __init acpi_cpufreq_init(void)
 	acpi_cpufreq_boost_init();
 
 	ret = cpufreq_register_driver(&acpi_cpufreq_driver);
-	if (ret)
+	if (ret) {
 		free_acpi_perf_data();
-
+		acpi_cpufreq_boost_exit();
+	}
 	return ret;
 }
 
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] acpi-cpufreq: De-register cpu notifier and free struct msr on error.
  2014-01-28  3:58 [PATCH] acpi-cpufreq: De-register cpu notifier and free struct msr on error Konrad Rzeszutek Wilk
@ 2014-01-28  9:41 ` Lukasz Majewski
  2014-02-03  6:22 ` Viresh Kumar
  1 sibling, 0 replies; 3+ messages in thread
From: Lukasz Majewski @ 2014-01-28  9:41 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: linux-kernel, rafael.j.wysocki, cpufreq, linux-pm,
	Konrad Rzeszutek Wilk, Myungjoo Ham, Viresh Kumar,
	Boris Ostrovsky

Hi Konrad,

> If cpufreq_register_driver() fails we would free the acpi driver
> related structures but not free the ones allocated
> by acpi_cpufreq_boost_init() function. This meant that as
> the driver error-ed out and a CPU online/offline event came
> we would crash and burn as one of the CPU notifiers would point
> to garbage.
> 

Thanks for spotting this bug. My bad.

> This fixes a regression that commit
> cfc9c8ed03e4d908f2388af8815f44c87b503aaf "acpi-cpufreq: Adjust the
> code to use the common boost attribute" introduced.
> 
> CC: Lukasz Majewski <l.majewski@samsung.com>
> CC: Myungjoo Ham <myungjoo.ham@samsung.com>
> CC: Viresh Kumar <viresh.kumar@linaro.org>
> CC: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  drivers/cpufreq/acpi-cpufreq.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/acpi-cpufreq.c
> b/drivers/cpufreq/acpi-cpufreq.c index 79e5608..3e856d6 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -969,9 +969,10 @@ static int __init acpi_cpufreq_init(void)
>  	acpi_cpufreq_boost_init();
>  
>  	ret = cpufreq_register_driver(&acpi_cpufreq_driver);
> -	if (ret)
> +	if (ret) {
>  		free_acpi_perf_data();
> -
> +		acpi_cpufreq_boost_exit();
> +	}
>  	return ret;
>  }
>  

Acked-by: Lukasz Majewski <l.majewski@samsung.com>

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] acpi-cpufreq: De-register cpu notifier and free struct msr on error.
  2014-01-28  3:58 [PATCH] acpi-cpufreq: De-register cpu notifier and free struct msr on error Konrad Rzeszutek Wilk
  2014-01-28  9:41 ` Lukasz Majewski
@ 2014-02-03  6:22 ` Viresh Kumar
  1 sibling, 0 replies; 3+ messages in thread
From: Viresh Kumar @ 2014-02-03  6:22 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: Linux Kernel Mailing List, Rafael J. Wysocki,
	cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
	Konrad Rzeszutek Wilk, Lukasz Majewski, Myungjoo Ham,
	Boris Ostrovsky

On 28 January 2014 09:28, Konrad Rzeszutek Wilk <konrad@kernel.org> wrote:
> If cpufreq_register_driver() fails we would free the acpi driver
> related structures but not free the ones allocated
> by acpi_cpufreq_boost_init() function. This meant that as
> the driver error-ed out and a CPU online/offline event came
> we would crash and burn as one of the CPU notifiers would point
> to garbage.
>
> This fixes a regression that commit cfc9c8ed03e4d908f2388af8815f44c87b503aaf
> "acpi-cpufreq: Adjust the code to use the common boost attribute"
> introduced.
>
> CC: Lukasz Majewski <l.majewski@samsung.com>
> CC: Myungjoo Ham <myungjoo.ham@samsung.com>
> CC: Viresh Kumar <viresh.kumar@linaro.org>
> CC: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  drivers/cpufreq/acpi-cpufreq.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-03  6:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-28  3:58 [PATCH] acpi-cpufreq: De-register cpu notifier and free struct msr on error Konrad Rzeszutek Wilk
2014-01-28  9:41 ` Lukasz Majewski
2014-02-03  6:22 ` Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).