Commit 99a52afd authored by Will Deacon's avatar Will Deacon Committed by Will Deacon
Browse files

FROMGIT: KVM: arm64: Tear down vGIC on failed vCPU creation



If kvm_arch_vcpu_create() fails to share the vCPU page with the
hypervisor, we propagate the error back to the ioctl but leave the
vGIC vCPU data initialised. Note only does this leak the corresponding
memory when the vCPU is destroyed but it can also lead to use-after-free
if the redistributor device handling tries to walk into the vCPU.

Add the missing cleanup to kvm_arch_vcpu_create(), ensuring that the
vGIC vCPU structures are destroyed on error.

Cc: <stable@vger.kernel.org>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Oliver Upton <oliver.upton@linux.dev>
Cc: Quentin Perret <qperret@google.com>
Signed-off-by: default avatarWill Deacon <will@kernel.org>
Reviewed-by: default avatarMarc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20250314133409.9123-1-will@kernel.org


Signed-off-by: default avatarOliver Upton <oliver.upton@linux.dev>
(cherry picked from commit 250f2536
 git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git next)
Bug: 395480470
Signed-off-by: default avatarWill Deacon <willdeacon@google.com>
Change-Id: I0d6710ecc1ef7208e79ea8103087b74b2515ffc2
parent 7f09360a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment