Commit 66768669 authored by Oliver Upton's avatar Oliver Upton Committed by Marc Zyngier
Browse files

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: default avatarZenghui Yu <yuzenghui@huawei.com>
Closes: https://lore.kernel.org/kvmarm/d0853e82-7d95-5025-7abf-c6f1e0cdf7b5@huawei.com/


Fixes: 481c9ee8 ("KVM: arm64: vgic-its: Get rid of the lpi_list_lock")
Signed-off-by: default avatarOliver Upton <oupton@kernel.org>
Link: https://patch.msgid.link/20251107184847.1784820-3-oupton@kernel.org


Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
parent 75360a9a
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -115,21 +115,18 @@ static struct vgic_irq *vgic_add_lpi(struct kvm *kvm, u32 intid,
		/* Someone was faster with adding this LPI, lets use that. */
		kfree(irq);
		irq = oldirq;

		goto out_unlock;
	} else {
		ret = xa_err(__xa_store(&dist->lpi_xa, intid, irq, 0));
	}

	ret = xa_err(__xa_store(&dist->lpi_xa, intid, irq, 0));
	xa_unlock_irqrestore(&dist->lpi_xa, flags);

	if (ret) {
		xa_release(&dist->lpi_xa, intid);
		kfree(irq);
	}

out_unlock:
	xa_unlock_irqrestore(&dist->lpi_xa, flags);

	if (ret)
		return ERR_PTR(ret);
	}

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