Commit 2ec02f6c authored by Ricardo Koller's avatar Ricardo Koller Committed by Marc Zyngier

KVM: arm64: vgic-v3: Check ITS region is not above the VM IPA size

Verify that the ITS region does not extend beyond the VM-specified IPA
range (phys_size).

  base + size > phys_size AND base < phys_size

Add the missing check into vgic_its_set_attr() which is called when
setting the region.
Reviewed-by: default avatarEric Auger <eric.auger@redhat.com>
Signed-off-by: default avatarRicardo Koller <ricarkol@google.com>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20211005011921.437353-5-ricarkol@google.com
parent c56a87da
...@@ -2710,8 +2710,8 @@ static int vgic_its_set_attr(struct kvm_device *dev, ...@@ -2710,8 +2710,8 @@ static int vgic_its_set_attr(struct kvm_device *dev,
if (copy_from_user(&addr, uaddr, sizeof(addr))) if (copy_from_user(&addr, uaddr, sizeof(addr)))
return -EFAULT; return -EFAULT;
ret = vgic_check_ioaddr(dev->kvm, &its->vgic_its_base, ret = vgic_check_iorange(dev->kvm, its->vgic_its_base,
addr, SZ_64K); addr, SZ_64K, KVM_VGIC_V3_ITS_SIZE);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment