From: Marc Zyngier Date: Thu, 29 Aug 2013 10:08:23 +0000 (+0100) Subject: ARM: KVM: vgic: fix GICD_ICFGRn access X-Git-Tag: firefly_0821_release~3680^2~36^2~16^2^2~229 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=635c887f2931a200a52694170122e2b62d1b6218;p=firefly-linux-kernel-4.4.55.git ARM: KVM: vgic: fix GICD_ICFGRn access All the code in handle_mmio_cfg_reg() assumes the offset has been shifted right to accomodate for the 2:1 bit compression, but this is only done when getting the register address. Shift the offset early so the code works mostly unchanged. Reported-by: Zhaobo (Bob, ERC) Signed-off-by: Marc Zyngier Signed-off-by: Gleb Natapov (cherry picked from commit 6545eae3d7a1b6dc2edb8ede9107998aee1207ef) Signed-off-by: Christoffer Dall --- diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index a2d478aec046..902789ff4abb 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -541,8 +541,12 @@ static bool handle_mmio_cfg_reg(struct kvm_vcpu *vcpu, struct kvm_exit_mmio *mmio, phys_addr_t offset) { u32 val; - u32 *reg = vgic_bitmap_get_reg(&vcpu->kvm->arch.vgic.irq_cfg, - vcpu->vcpu_id, offset >> 1); + u32 *reg; + + offset >>= 1; + reg = vgic_bitmap_get_reg(&vcpu->kvm->arch.vgic.irq_cfg, + vcpu->vcpu_id, offset); + if (offset & 2) val = *reg >> 16; else