From patchwork Tue Jun 2 14:48:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 49388 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8376720BD1 for ; Tue, 2 Jun 2015 14:50:21 +0000 (UTC) Received: by wibut5 with SMTP id ut5sf14717671wib.0 for ; Tue, 02 Jun 2015 07:50:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=oo9GYKaQXfS5Y4R5tt2UqFf/a/dgmTKnc8P68YBUeu8=; b=hJOHKhjDCEdWwUoqF/SzTf4UswUZnFFUyKuoPEGsoiQpD9JmU8i2oDy17AIEs7eXW9 Lpty1frhvogXPPbYu2YXLyHe+eAIV1e+LSSLf68G1vJa3i+MVvXsW6J/cYtZcago8dfK MWBQc36rjEEyMrZbAMVQ7aqhDCvJQv/YeMGCu11GYhMKoAMzcC79UFHnRMWtiwJHeHrf AJg0spxti7wQH6CNLFH1AXck7tAtUk6LFU+QogjTdklxwzTdh/w1k1Ca99d8loZrATRG zCVVa4pLWOWNbTnxU5NsCZZ0V0F40c4JH7yI3Uk8yj/jOnkhQUfIWSjS4pRjzBMkvnU4 CdCA== X-Gm-Message-State: ALoCoQmbMY9XFNoarZy7cSF87ldijF2YIZhZdtqFwaX9Pc5yntfMRpYK7uye4VYZWuFqyQkIz4cA X-Received: by 10.113.11.3 with SMTP id ee3mr26365591lbd.9.1433256620820; Tue, 02 Jun 2015 07:50:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.162 with SMTP id g2ls795317lae.80.gmail; Tue, 02 Jun 2015 07:50:20 -0700 (PDT) X-Received: by 10.112.218.67 with SMTP id pe3mr25485212lbc.53.1433256620671; Tue, 02 Jun 2015 07:50:20 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id uq2si15268441lbc.120.2015.06.02.07.50.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jun 2015 07:50:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by laei3 with SMTP id i3so39640975lae.3 for ; Tue, 02 Jun 2015 07:50:20 -0700 (PDT) X-Received: by 10.112.198.74 with SMTP id ja10mr26653695lbc.19.1433256620505; Tue, 02 Jun 2015 07:50:20 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp3128956lbb; Tue, 2 Jun 2015 07:50:19 -0700 (PDT) X-Received: by 10.68.252.233 with SMTP id zv9mr13065863pbc.109.1433256618628; Tue, 02 Jun 2015 07:50:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hv8si26697315pdb.173.2015.06.02.07.50.17; Tue, 02 Jun 2015 07:50:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759318AbbFBOuR (ORCPT + 2 others); Tue, 2 Jun 2015 10:50:17 -0400 Received: from mail-ob0-f170.google.com ([209.85.214.170]:33211 "EHLO mail-ob0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759174AbbFBOuQ (ORCPT ); Tue, 2 Jun 2015 10:50:16 -0400 Received: by obbnx5 with SMTP id nx5so129181430obb.0 for ; Tue, 02 Jun 2015 07:50:15 -0700 (PDT) X-Received: by 10.182.129.105 with SMTP id nv9mr23210626obb.69.1433256615781; Tue, 02 Jun 2015 07:50:15 -0700 (PDT) Received: from localhost ([167.160.116.34]) by mx.google.com with ESMTPSA id j73sm9606883oib.21.2015.06.02.07.50.13 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 02 Jun 2015 07:50:14 -0700 (PDT) From: shannon.zhao@linaro.org To: stable@vger.kernel.org Cc: gregkh@linuxfoundation.org, christoffer.dall@linaro.org, shannon.zhao@linaro.org Subject: [PATCH for 3.14.y stable 13/32] arm/arm64: KVM: Fix set_clear_sgi_pend_reg offset Date: Tue, 2 Jun 2015 22:48:08 +0800 Message-Id: <1433256507-7856-14-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1433256507-7856-1-git-send-email-shannon.zhao@linaro.org> References: <1433256507-7856-1-git-send-email-shannon.zhao@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: shannon.zhao@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Christoffer Dall commit 0fea6d7628ed6e25a9ee1b67edf7c859718d39e8 upstream. 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 Signed-off-by: Christoffer Dall Signed-off-by: Shannon Zhao --- 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 2187318..5309a1d 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -674,7 +674,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; @@ -695,7 +695,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;