From patchwork Tue Jun 30 10:48:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 50451 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 99E61229DF for ; Tue, 30 Jun 2015 10:50:04 +0000 (UTC) Received: by widjy10 with SMTP id jy10sf5181136wid.3 for ; Tue, 30 Jun 2015 03:50:03 -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=QAwf5HZPe3FeavoqUSlMuyoxxDH+2Z44r2eLQ+u1fXfVnXMGp/SuEp6cCr2i76hiGf bt55yS9uORhSqjwyrIg7nEW2x5MLkPrBbH1kBqK84ah9V7WggHC6dueU26GpE6Cu1zTO vtcVfS/tgMDpeSo9ZgIs0JqM+cTKpsQouMXl6vV2XXBe5NFv9Yun4PC6BGRw9ji4RACa uO5PUjRsmyDKsSBpA0BXu/PbB6FjeAvwh36aI9gvfvgrA3u3pyBvNXRVbJEJolRoGFvT 3EatwKDMuGq4s3DSFqn/YsN6VVyyigq9J8gmB6M5sOcpFOoSuOvcwlO3FAW7V/XNy6uu kQKA== X-Gm-Message-State: ALoCoQlhRfHworD5YoXKif3NyCaVZQyZPzxTdzFs6ADEiz/mPwKL3kafcHPFBWOAdNnL6RWDUIy2 X-Received: by 10.180.81.170 with SMTP id b10mr11487481wiy.4.1435661403840; Tue, 30 Jun 2015 03:50:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.116.7 with SMTP id js7ls24561lab.34.gmail; Tue, 30 Jun 2015 03:50:03 -0700 (PDT) X-Received: by 10.112.25.39 with SMTP id z7mr19373620lbf.102.1435661403525; Tue, 30 Jun 2015 03:50:03 -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 jx2si37776392lbc.124.2015.06.30.03.50.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jun 2015 03:50:03 -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 lagx9 with SMTP id x9so8131882lag.1 for ; Tue, 30 Jun 2015 03:50:03 -0700 (PDT) X-Received: by 10.112.198.74 with SMTP id ja10mr18952293lbc.19.1435661403387; Tue, 30 Jun 2015 03:50:03 -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 hn6csp2352481lbb; Tue, 30 Jun 2015 03:50:02 -0700 (PDT) X-Received: by 10.68.180.67 with SMTP id dm3mr42457303pbc.167.1435661401448; Tue, 30 Jun 2015 03:50:01 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5si66313267par.87.2015.06.30.03.50.00; Tue, 30 Jun 2015 03:50:01 -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 S1751344AbbF3KuA (ORCPT + 2 others); Tue, 30 Jun 2015 06:50:00 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:36300 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752184AbbF3Kt7 (ORCPT ); Tue, 30 Jun 2015 06:49:59 -0400 Received: by paceq1 with SMTP id eq1so3776607pac.3 for ; Tue, 30 Jun 2015 03:49:58 -0700 (PDT) X-Received: by 10.68.167.131 with SMTP id zo3mr41838452pbb.123.1435661398758; Tue, 30 Jun 2015 03:49:58 -0700 (PDT) Received: from localhost ([120.136.36.232]) by mx.google.com with ESMTPSA id ez4sm10988264pbb.13.2015.06.30.03.49.56 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 30 Jun 2015 03:49:57 -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 03/22] arm/arm64: KVM: Fix set_clear_sgi_pend_reg offset Date: Tue, 30 Jun 2015 18:48:51 +0800 Message-Id: <1435661350-8060-4-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1435661350-8060-1-git-send-email-shannon.zhao@linaro.org> References: <1435661350-8060-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;