summaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-12-16 11:16:34 +0100
committerAvi Kivity <avi@redhat.com>2010-12-16 11:39:31 +0100
commit3e26f23091da06d02fa62da14c95f3688d27857c (patch)
tree17ee88442a9a45a86a8bd8b69944a24ed041244a /arch/x86
parentKVM: enlarge number of possible CPUID leaves (diff)
downloadlinux-3e26f23091da06d02fa62da14c95f3688d27857c.tar.xz
linux-3e26f23091da06d02fa62da14c95f3688d27857c.zip
KVM: Fix preemption counter leak in kvm_timer_init()
Based on a patch from Thomas Meyer. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/x86.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index e3abd84750c7..b989e1f1e5d3 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4564,9 +4564,11 @@ static void kvm_timer_init(void)
#ifdef CONFIG_CPU_FREQ
struct cpufreq_policy policy;
memset(&policy, 0, sizeof(policy));
- cpufreq_get_policy(&policy, get_cpu());
+ cpu = get_cpu();
+ cpufreq_get_policy(&policy, cpu);
if (policy.cpuinfo.max_freq)
max_tsc_khz = policy.cpuinfo.max_freq;
+ put_cpu();
#endif
cpufreq_register_notifier(&kvmclock_cpufreq_notifier_block,
CPUFREQ_TRANSITION_NOTIFIER);