summaryrefslogtreecommitdiff
path: root/virt/kvm/arm/vgic/vgic-its.c
diff options
context:
space:
mode:
authorChristoffer Dall <christoffer.dall@linaro.org>2017-11-10 11:16:23 +0300
committerChristoffer Dall <christoffer.dall@linaro.org>2017-11-10 11:55:59 +0300
commit3d1ad640f8c94a9ae9c7c8bbb311614bc0332a7e (patch)
tree7ca1847dee2a945c4ad3a7e8935cdf8fd60b344b /virt/kvm/arm/vgic/vgic-its.c
parented8703a506a8241f921feb63a656d0ff5a090895 (diff)
downloadlinux-3d1ad640f8c94a9ae9c7c8bbb311614bc0332a7e.tar.xz
KVM: arm/arm64: Fix GICv4 ITS initialization issues
We should only try to initialize GICv4 data structures on a GICv4 capable system. Move the vgic_supports_direct_msis() check inito vgic_v4_init() so that any KVM VGIC initialization path does not fail on non-GICv4 systems. Also be slightly more strict in the checking of the return value in vgic_its_create, and only error out on negative return values from the vgic_v4_init() function. This is important because the kvm device code only treats negative values as errors and only cleans up in this case. Errornously treating a positive return value as an error from the vgic_v4_init() function can lead to NULL pointer dereferences, as has recently been observed. Acked-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'virt/kvm/arm/vgic/vgic-its.c')
-rw-r--r--virt/kvm/arm/vgic/vgic-its.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c
index b8c1b724ba3e..c93ecd4a903b 100644
--- a/virt/kvm/arm/vgic/vgic-its.c
+++ b/virt/kvm/arm/vgic/vgic-its.c
@@ -1673,7 +1673,7 @@ static int vgic_its_create(struct kvm_device *dev, u32 type)
if (vgic_initialized(dev->kvm)) {
int ret = vgic_v4_init(dev->kvm);
- if (ret) {
+ if (ret < 0) {
kfree(its);
return ret;
}