All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm/arm64: KVM: Fix set_clear_sgi_pend_reg offset
@ 2014-09-25 17:49 ` Christoffer Dall
  0 siblings, 0 replies; 18+ messages in thread
From: Christoffer Dall @ 2014-09-25 17:49 UTC (permalink / raw)
  To: kvmarm, linux-arm-kernel; +Cc: kvm, zhaoshenglong, Christoffer Dall

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>
---
 virt/kvm/arm/vgic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
index b6fab0f..8629678 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,
 {
 	struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
 	int sgi;
-	int min_sgi = (offset & ~0x3) * 4;
+	int min_sgi = (offset & ~0x3);
 	int max_sgi = min_sgi + 3;
 	int vcpu_id = vcpu->vcpu_id;
 	u32 reg = 0;
@@ -837,7 +837,7 @@ static bool write_set_clear_sgi_pend_reg(struct kvm_vcpu *vcpu,
 {
 	struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
 	int sgi;
-	int min_sgi = (offset & ~0x3) * 4;
+	int min_sgi = (offset & ~0x3);
 	int max_sgi = min_sgi + 3;
 	int vcpu_id = vcpu->vcpu_id;
 	u32 reg;
-- 
2.0.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2014-09-30 11:41 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-25 17:49 [PATCH] arm/arm64: KVM: Fix set_clear_sgi_pend_reg offset Christoffer Dall
2014-09-25 17:49 ` Christoffer Dall
2014-09-26  5:57 ` Shannon Zhao
2014-09-26  5:57   ` Shannon Zhao
2014-09-26  8:44   ` Christoffer Dall
2014-09-26  8:44     ` Christoffer Dall
2014-09-26  9:26     ` Shannon Zhao
2014-09-26  9:26       ` Shannon Zhao
2014-09-26 10:16       ` Christoffer Dall
2014-09-26 10:16         ` Christoffer Dall
2014-09-26 13:44         ` Christoffer Dall
2014-09-26 13:44           ` Christoffer Dall
2014-09-30  1:48           ` Shannon Zhao
2014-09-30  1:48             ` Shannon Zhao
2014-09-30 11:41             ` Christoffer Dall
2014-09-30 11:41               ` Christoffer Dall
2014-09-26  9:30 ` Shannon Zhao
2014-09-26  9:30   ` Shannon Zhao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.