If the target is self we do not need to yield, we can avoid malicious
guest to play this.
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
Message-Id: <
1617941911-5338-3-git-send-email-wanpengli@tencent.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
if (!target || !READ_ONCE(target->ready))
goto no_yield;
+ /* Ignore requests to yield to self */
+ if (vcpu == target)
+ goto no_yield;
+
if (kvm_vcpu_yield_to(target) <= 0)
goto no_yield;