From: Avi Kivity Date: Thu, 16 Dec 2010 10:16:34 +0000 (+0200) Subject: KVM: Fix preemption counter leak in kvm_timer_init() X-Git-Tag: 2.1b_release~6050^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3e26f23091da06d02fa62da14c95f3688d27857c;p=platform%2Fkernel%2Fkernel-mfld-blackbay.git KVM: Fix preemption counter leak in kvm_timer_init() Based on a patch from Thomas Meyer. Signed-off-by: Avi Kivity --- diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index e3abd84..b989e1f 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);