[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1417686484-20828-5-git-send-email-eric.auger@linaro.org>
Date: Thu, 4 Dec 2014 10:48:04 +0100
From: Eric Auger <eric.auger@...aro.org>
To: eric.auger@...com, eric.auger@...aro.org,
christoffer.dall@...aro.org, marc.zyngier@....com,
andre.przywara@....com, linux-arm-kernel@...ts.infradead.org,
kvmarm@...ts.cs.columbia.edu, kvm@...r.kernel.org,
alex.williamson@...hat.com, agraf@...e.de, gleb@...nel.org,
pbonzini@...hat.com
Cc: linux-kernel@...r.kernel.org, patches@...aro.org,
will.deacon@....com, a.motakis@...tualopensystems.com
Subject: [PATCH v2 4/4] KVM: arm/arm64: vgic: check vgic_initialized in KVM_DEV_ARM_VGIC_GRP_ADDR
This patch prevents user-space from changing VGIC base addresses
if the vgic already is initialized.
Signed-off-by: Eric Auger <eric.auger@...aro.org>
---
Documentation/virtual/kvm/devices/arm-vgic.txt | 2 ++
virt/kvm/arm/vgic.c | 3 +++
2 files changed, 5 insertions(+)
diff --git a/Documentation/virtual/kvm/devices/arm-vgic.txt b/Documentation/virtual/kvm/devices/arm-vgic.txt
index 30f5427..8492715 100644
--- a/Documentation/virtual/kvm/devices/arm-vgic.txt
+++ b/Documentation/virtual/kvm/devices/arm-vgic.txt
@@ -19,6 +19,8 @@ Groups:
KVM_VGIC_V2_ADDR_TYPE_CPU (rw, 64-bit)
Base address in the guest physical address space of the GIC virtual cpu
interface register mappings.
+ Errors:
+ -EBUSY: VGIC already is initialized
KVM_DEV_ARM_VGIC_GRP_DIST_REGS
Attributes:
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
index 89dca86..652e0bb 100644
--- a/virt/kvm/arm/vgic.c
+++ b/virt/kvm/arm/vgic.c
@@ -2427,6 +2427,9 @@ static int vgic_set_attr(struct kvm_device *dev, struct kvm_device_attr *attr)
u64 addr;
unsigned long type = (unsigned long)attr->attr;
+ if (vgic_initialized(dev->kvm))
+ return -EBUSY;
+
if (copy_from_user(&addr, uaddr, sizeof(addr)))
return -EFAULT;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists