On Tue, Feb 13, 2024 at 09:32:39AM +0000, Oliver Upton wrote: [...] > @@ -87,10 +93,20 @@ static struct vgic_irq *vgic_add_lpi(struct kvm *kvm, u32 intid, > goto out_unlock; > } > > + ret = xa_err(xa_store(&dist->lpi_xa, intid, irq, 0)); > + if (ret) { > + xa_release(&dist->lpi_xa, intid); > + kfree(irq); > + goto out_unlock; > + } > + > list_add_tail(&irq->lpi_list, &dist->lpi_list_head); > dist->lpi_list_count++; > > out_unlock: > + if (ret) > + return ERR_PTR(ret); > + > raw_spin_unlock_irqrestore(&dist->lpi_list_lock, flags); Hah, I need to get my head checked. This is *still* wrong! --- diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c index 0265cd1f2d6e..5579660abf7a 100644 --- a/arch/arm64/kvm/vgic/vgic-its.c +++ b/arch/arm64/kvm/vgic/vgic-its.c @@ -104,11 +104,11 @@ static struct vgic_irq *vgic_add_lpi(struct kvm *kvm, u32 intid, dist->lpi_list_count++; out_unlock: + raw_spin_unlock_irqrestore(&dist->lpi_list_lock, flags); + if (ret) return ERR_PTR(ret); - raw_spin_unlock_irqrestore(&dist->lpi_list_lock, flags); - /* * We "cache" the configuration table entries in our struct vgic_irq's. * However we only have those structs for mapped IRQs, so we read in -- Thanks, Oliver