Blob Blame History Raw
From: Eric Auger <eric.auger@redhat.com>
Date: Thu, 26 Oct 2017 17:23:04 +0200
Subject: KVM: arm/arm64: vgic-its: Fix vgic_its_restore_collection_table
 returned value
Patch-mainline: v4.14-rc8
Git-commit: f31b98b57f72dcd458eb63f795f4efe272acc2e3
References: bsc#1077761

vgic_its_restore_cte returns +1 if the collection table entry
is valid and properly decoded. As a consequence, if the
collection table is fully filled with valid data that are
decoded without error, vgic_its_restore_collection_table()
returns +1. This is wrong.

Let's return 0 in that case.

Fixes: ea1ad53e1e31a3 (KVM: arm64: vgic-its: Collection table save/restore)
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Acked-by: Alexander Graf <agraf@suse.de>
---
 virt/kvm/arm/vgic/vgic-its.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/virt/kvm/arm/vgic/vgic-its.c
+++ b/virt/kvm/arm/vgic/vgic-its.c
@@ -2264,6 +2264,10 @@
 		gpa += cte_esz;
 		read += cte_esz;
 	}
+
+	if (ret > 0)
+		return 0;
+
 	return ret;
 }