Skip to content

Commit 268cbfe

Browse files
sean-jcbonzini
authored andcommitted
KVM: SVM: WARN if an invalid posted interrupt IRTE entry is added
Now that the AMD IOMMU doesn't signal success incorrectly, WARN if KVM attempts to track an AMD IRTE entry without metadata. Signed-off-by: Sean Christopherson <[email protected]> Message-ID: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent aae251a commit 268cbfe

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arch/x86/kvm/svm/avic.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -796,12 +796,15 @@ static int svm_ir_list_add(struct vcpu_svm *svm, struct amd_iommu_pi_data *pi)
796796
struct amd_svm_iommu_ir *ir;
797797
u64 entry;
798798

799+
if (WARN_ON_ONCE(!pi->ir_data))
800+
return -EINVAL;
801+
799802
/**
800803
* In some cases, the existing irte is updated and re-set,
801804
* so we need to check here if it's already been * added
802805
* to the ir_list.
803806
*/
804-
if (pi->ir_data && (pi->prev_ga_tag != 0)) {
807+
if (pi->prev_ga_tag) {
805808
struct kvm *kvm = svm->vcpu.kvm;
806809
u32 vcpu_id = AVIC_GATAG_TO_VCPUID(pi->prev_ga_tag);
807810
struct kvm_vcpu *prev_vcpu = kvm_get_vcpu_by_id(kvm, vcpu_id);

0 commit comments

Comments
 (0)