diff options
author | Christoffer Dall <christoffer.dall@linaro.org> | 2014-09-25 12:41:07 -0400 |
---|---|---|
committer | Christoffer Dall <christoffer.dall@linaro.org> | 2014-09-25 13:38:25 -0400 |
commit | 0fea6d7628ed6e25a9ee1b67edf7c859718d39e8 (patch) | |
tree | 54f72db11bf95f7962ab3edb741c47d4db66e2ad /virt | |
parent | a98f26f183801685ef57333de4bafd4bbc692c7c (diff) |
arm/arm64: KVM: Fix set_clear_sgi_pend_reg offset
The sgi values calculated in read_set_clear_sgi_pend_reg() and
write_set_clear_sgi_pend_reg() were horribly incorrectly multiplied by 4
with catastrophic results in that subfunctions ended up overwriting
memory not allocated for the expected purpose.
This showed up as bugs in kfree() and the kernel complaining a lot of
you turn on memory debugging.
This addresses: http://marc.info/?l=kvm&m=141164910007868&w=2
Reported-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/arm/vgic.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index b6fab0f25f3b..862967852d5a 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c | |||
@@ -816,7 +816,7 @@ static bool read_set_clear_sgi_pend_reg(struct kvm_vcpu *vcpu, | |||
816 | { | 816 | { |
817 | struct vgic_dist *dist = &vcpu->kvm->arch.vgic; | 817 | struct vgic_dist *dist = &vcpu->kvm->arch.vgic; |
818 | int sgi; | 818 | int sgi; |
819 | int min_sgi = (offset & ~0x3) * 4; | 819 | int min_sgi = (offset & ~0x3); |
820 | int max_sgi = min_sgi + 3; | 820 | int max_sgi = min_sgi + 3; |
821 | int vcpu_id = vcpu->vcpu_id; | 821 | int vcpu_id = vcpu->vcpu_id; |
822 | u32 reg = 0; | 822 | u32 reg = 0; |
@@ -837,7 +837,7 @@ static bool write_set_clear_sgi_pend_reg(struct kvm_vcpu *vcpu, | |||
837 | { | 837 | { |
838 | struct vgic_dist *dist = &vcpu->kvm->arch.vgic; | 838 | struct vgic_dist *dist = &vcpu->kvm->arch.vgic; |
839 | int sgi; | 839 | int sgi; |
840 | int min_sgi = (offset & ~0x3) * 4; | 840 | int min_sgi = (offset & ~0x3); |
841 | int max_sgi = min_sgi + 3; | 841 | int max_sgi = min_sgi + 3; |
842 | int vcpu_id = vcpu->vcpu_id; | 842 | int vcpu_id = vcpu->vcpu_id; |
843 | u32 reg; | 843 | u32 reg; |