KVM: x86: degrade WARN to pr_warn_ratelimited
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 26 Jun 2019 12:16:13 +0000 (14:16 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 2 Jul 2019 17:02:44 +0000 (19:02 +0200)
This warning can be triggered easily by userspace, so it should certainly not
cause a panic if panic_on_warn is set.

Reported-by: syzbot+c03f30b4f4c46bdf8575@syzkaller.appspotmail.com
Suggested-by: Alexander Potapenko <glider@google.com>
Acked-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c

index 9857992d4e5885565c696f3ca5c4006ccd541a49..fafd81d2c9ea8537046c46dcb779e928eef16826 100644 (file)
@@ -1554,7 +1554,7 @@ static int set_tsc_khz(struct kvm_vcpu *vcpu, u32 user_tsc_khz, bool scale)
                        vcpu->arch.tsc_always_catchup = 1;
                        return 0;
                } else {
-                       WARN(1, "user requested TSC rate below hardware speed\n");
+                       pr_warn_ratelimited("user requested TSC rate below hardware speed\n");
                        return -1;
                }
        }
@@ -1564,8 +1564,8 @@ static int set_tsc_khz(struct kvm_vcpu *vcpu, u32 user_tsc_khz, bool scale)
                                user_tsc_khz, tsc_khz);
 
        if (ratio == 0 || ratio >= kvm_max_tsc_scaling_ratio) {
-               WARN_ONCE(1, "Invalid TSC scaling ratio - virtual-tsc-khz=%u\n",
-                         user_tsc_khz);
+               pr_warn_ratelimited("Invalid TSC scaling ratio - virtual-tsc-khz=%u\n",
+                                   user_tsc_khz);
                return -1;
        }