]> www.infradead.org Git - users/jedix/linux-maple.git/commit
intel_idle: Avoid a double free of the per-CPU data.
authorRichard Cochran <rcochran@linutronix.de>
Wed, 6 Apr 2016 21:00:53 +0000 (17:00 -0400)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 3 Nov 2016 17:25:41 +0000 (10:25 -0700)
commit71971d38f7a59bf4b88bb71995b95305baed94de
tree05d55800eda974b38e279b33a89dbabad8c3f7e4
parentbf8d9ab904b77361850fcaf380efa0baf91e555d
intel_idle: Avoid a double free of the per-CPU data.

Orabug: 24810432

The helper function, intel_idle_cpuidle_devices_uninit, frees the
globally allocated per-CPU data.  However, this function is invoked
from the hot plug notifier callback at a time when freeing that data
is not safe.

If the call to cpuidle_register_driver() should fail (say, due to lack
of memory), then the driver will free its per-CPU region.  On the
*next* CPU_ONLINE event, the driver will happily use the region again
and even free it again if the failure repeats.

This patch fixes the issue by moving the call to free_percpu() outside
of the helper function at the two call sites that actually need to
free the per-CPU data.

Signed-off-by: Richard Cochran <rcochran@linutronix.de>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit ca42489d9ee3262482717c83428e087322fdc39c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/idle/intel_idle.c