lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZcvknAFyvCl6bRgd@linux.dev>
Date: Tue, 13 Feb 2024 21:52:28 +0000
From: Oliver Upton <oliver.upton@...ux.dev>
To: kvmarm@...ts.linux.dev
Cc: kvm@...r.kernel.org, Marc Zyngier <maz@...nel.org>,
	James Morse <james.morse@....com>,
	Suzuki K Poulose <suzuki.poulose@....com>,
	Zenghui Yu <yuzenghui@...wei.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 02/23] KVM: arm64: vgic: Store LPIs in an xarray

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ