From patchwork Mon May 4 01:52:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 47966 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 699B12121F for ; Mon, 4 May 2015 01:55:44 +0000 (UTC) Received: by wiun10 with SMTP id n10sf30525895wiu.1 for ; Sun, 03 May 2015 18:55:43 -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=QsESZR80w73GkJxhGv2UTNH7kW96qnmqY9cjOdnd+fwmHSFnJd9+BMidJmMAgH87/t mwkNY0e7qjPKqU9ARbAgwlU31UWhtYVJn2lERrgrBEmDg66MDEniFD1FUbqQPOgfG5hV b7x1DVFqDYwp5Mw2+1GbPbLSUfH3+8ippdXIW+afeWGYANrjdx9uZSYEJFGRepQjUjzQ e4uENOCw7UxcPdRbNnmlTibpvR2oUECjNzeUDx61o1iGGWI6Zc/6srbjqiD42x3LeBXL BKOlkPDtDAe30qdkyuziGlNN2F/aEOhbZMD8Eh+Ajv+aWv+JwCWH3vUC4t/FuanE2rKb o7zA== X-Gm-Message-State: ALoCoQk7tlcYXRnBzAUAZTZA9Xt2m9GcngPmQi3pdDiLIiFfnX+pHVgflxx+4MQVScR/mQHywGqE X-Received: by 10.152.184.73 with SMTP id es9mr16974545lac.4.1430704543751; Sun, 03 May 2015 18:55:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.204 with SMTP id ba12ls709961lab.41.gmail; Sun, 03 May 2015 18:55:43 -0700 (PDT) X-Received: by 10.112.204.72 with SMTP id kw8mr17645035lbc.88.1430704543610; Sun, 03 May 2015 18:55:43 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id y10si9079253lal.107.2015.05.03.18.55.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 May 2015 18:55:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by laat2 with SMTP id t2so95043624laa.1 for ; Sun, 03 May 2015 18:55:43 -0700 (PDT) X-Received: by 10.153.6.36 with SMTP id cr4mr18041391lad.56.1430704543472; Sun, 03 May 2015 18:55:43 -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.67.65 with SMTP id l1csp1413001lbt; Sun, 3 May 2015 18:55:42 -0700 (PDT) X-Received: by 10.68.136.42 with SMTP id px10mr38572739pbb.19.1430704541751; Sun, 03 May 2015 18:55:41 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ix6si17838787pac.46.2015.05.03.18.55.40; Sun, 03 May 2015 18:55:41 -0700 (PDT) Received-SPF: none (google.com: stable-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751948AbbEDBzk (ORCPT + 2 others); Sun, 3 May 2015 21:55:40 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:35496 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751923AbbEDBzk (ORCPT ); Sun, 3 May 2015 21:55:40 -0400 Received: by pdbqd1 with SMTP id qd1so150098074pdb.2 for ; Sun, 03 May 2015 18:55:39 -0700 (PDT) X-Received: by 10.70.0.201 with SMTP id 9mr26262319pdg.4.1430704539743; Sun, 03 May 2015 18:55:39 -0700 (PDT) Received: from localhost ([180.150.153.1]) by mx.google.com with ESMTPSA id o4sm11047686pdh.22.2015.05.03.18.55.37 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 03 May 2015 18:55:38 -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 28/47] arm/arm64: KVM: Fix set_clear_sgi_pend_reg offset Date: Mon, 4 May 2015 09:52:23 +0800 Message-Id: <1430704362-6292-29-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1430704362-6292-1-git-send-email-shannon.zhao@linaro.org> References: <1430704362-6292-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.54 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;