KVM: arm/arm64: vgic-its: Fix vgic_its_restore_collection_table returned value
authorEric Auger <eric.auger@redhat.com>
Thu, 26 Oct 2017 15:23:04 +0000 (17:23 +0200)
committerChristoffer Dall <christoffer.dall@linaro.org>
Sun, 29 Oct 2017 02:25:06 +0000 (03:25 +0100)
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>
virt/kvm/arm/vgic/vgic-its.c

index 76685f4c6261ee9c21811c0ec1f116591dd06037..6a715a6ec64e4666bc514a7711a1214703eb5972 100644 (file)
@@ -2264,6 +2264,10 @@ static int vgic_its_restore_collection_table(struct vgic_its *its)
                gpa += cte_esz;
                read += cte_esz;
        }
+
+       if (ret > 0)
+               return 0;
+
        return ret;
 }