Skip to content

Commit 6676866

Browse files
Oliver UptonMarc Zyngier
authored andcommitted
KVM: arm64: vgic-v3: Release reserved slot outside of lpi_xa's lock
xa_release() expects to be called outside of the xa_lock. Fix vgic_add_lpi() to drop the lock before calling and restructure to get rid of the goto label. Reported-by: Zenghui Yu <yuzenghui@huawei.com> Closes: https://lore.kernel.org/kvmarm/d0853e82-7d95-5025-7abf-c6f1e0cdf7b5@huawei.com/ Fixes: 481c9ee ("KVM: arm64: vgic-its: Get rid of the lpi_list_lock") Signed-off-by: Oliver Upton <oupton@kernel.org> Link: https://patch.msgid.link/20251107184847.1784820-3-oupton@kernel.org Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent 75360a9 commit 6676866

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

arch/arm64/kvm/vgic/vgic-its.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,18 @@ static struct vgic_irq *vgic_add_lpi(struct kvm *kvm, u32 intid,
115115
/* Someone was faster with adding this LPI, lets use that. */
116116
kfree(irq);
117117
irq = oldirq;
118-
119-
goto out_unlock;
118+
} else {
119+
ret = xa_err(__xa_store(&dist->lpi_xa, intid, irq, 0));
120120
}
121121

122-
ret = xa_err(__xa_store(&dist->lpi_xa, intid, irq, 0));
122+
xa_unlock_irqrestore(&dist->lpi_xa, flags);
123+
123124
if (ret) {
124125
xa_release(&dist->lpi_xa, intid);
125126
kfree(irq);
126-
}
127127

128-
out_unlock:
129-
xa_unlock_irqrestore(&dist->lpi_xa, flags);
130-
131-
if (ret)
132128
return ERR_PTR(ret);
129+
}
133130

134131
/*
135132
* We "cache" the configuration table entries in our struct vgic_irq's.

0 commit comments

Comments
 (0)