Commit 3e26f230 authored by Avi Kivity's avatar Avi Kivity

KVM: Fix preemption counter leak in kvm_timer_init()

Based on a patch from Thomas Meyer.
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent 73c1160c
...@@ -4564,9 +4564,11 @@ static void kvm_timer_init(void) ...@@ -4564,9 +4564,11 @@ static void kvm_timer_init(void)
#ifdef CONFIG_CPU_FREQ #ifdef CONFIG_CPU_FREQ
struct cpufreq_policy policy; struct cpufreq_policy policy;
memset(&policy, 0, sizeof(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) if (policy.cpuinfo.max_freq)
max_tsc_khz = policy.cpuinfo.max_freq; max_tsc_khz = policy.cpuinfo.max_freq;
put_cpu();
#endif #endif
cpufreq_register_notifier(&kvmclock_cpufreq_notifier_block, cpufreq_register_notifier(&kvmclock_cpufreq_notifier_block,
CPUFREQ_TRANSITION_NOTIFIER); CPUFREQ_TRANSITION_NOTIFIER);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment