Received: by 10.213.65.68 with SMTP id h4csp699334imn; Tue, 27 Mar 2018 07:12:45 -0700 (PDT) X-Google-Smtp-Source: AG47ELuFaRfsjkjRsR8fMGxUOk93cKuy8tLpFRI2owL3wbKRDU7jDnwm5h4etJZLI2/Nftu1LUT2 X-Received: by 10.98.5.71 with SMTP id 68mr36390618pff.241.1522159965358; Tue, 27 Mar 2018 07:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522159965; cv=none; d=google.com; s=arc-20160816; b=m76VnNLpNynXkWxKh+oiMhWd2/gkaesKWgnk/3mBRZEko9IsfkEU5CujBY/Ov90F7W 0P5Y3fEd4nKIGy5TUFtiVuYQJ7ilmlMB2N2/kzi/kEj8KpcMsrwJxVUDNTYtBJdC2GDQ m2nDaUwlkSx0QJDE+XU41vSBTCERG7S1dwQZs7HvYvjdLNQMNi5P1p7Jk2QVDKAGYeOV sCVCaGY6zqfzksbnGMnZCGfNg6GHJj0iwPShE3wM/IxljO2WLMJPF51EZRTtDHQzv9yQ EOBlTAPBjBxlFJ/XfPMqD2jEvbj6giXVbQPV1VYsCORYcloYbmfJer79sxni0KkbtAUV fUEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=f0rLSoGIoIi5JChtjLPznaj1hwoj6NBV2Vy2F67UVCg=; b=tGDHdk6Qp2CtKzrNXv6RbCFW9pX2kXkBjkFAsyoanssoQoyHRgapgCguF4uQdVE3Sz 9gMksHEeZZL2nNs3MbwLRwcrO7DTsn4gDAP6Lv5DA8kDeo+UwXK66jBJkR8uMfuNFEgE 97WMbA04vy/k8w9jImLZqawpKChjpzcWftSHJZ3Wt4p6fOcGPik84WrBdAQDtfxBGGRY uLf8Zd7emzTPlyibyc5Q450pqrOImlyDs1OZEz899+Z3J3cHP0RvUpCIjSPv+I0qcjQT DvWsAXG45uaBQwFF8JJATOMnZdo8Zfn358e+WB3saTteuAqMkdOmW1kh8VrqhjPO0Gqg KLoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o6-v6si1407503plh.300.2018.03.27.07.12.13; Tue, 27 Mar 2018 07:12:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752613AbeC0OE2 (ORCPT + 99 others); Tue, 27 Mar 2018 10:04:28 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49004 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750914AbeC0OE0 (ORCPT ); Tue, 27 Mar 2018 10:04:26 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3891680AD238; Tue, 27 Mar 2018 14:04:26 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-135.ams2.redhat.com [10.36.116.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A402215CDB5; Tue, 27 Mar 2018 14:04:24 +0000 (UTC) From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, marc.zyngier@arm.com, cdall@kernel.org, peter.maydell@linaro.org Cc: andre.przywara@arm.com, drjones@redhat.com, wei@redhat.com Subject: [RFC v2 01/12] KVM: arm/arm64: Set dist->spis to NULL after kfree Date: Tue, 27 Mar 2018 16:04:05 +0200 Message-Id: <1522159456-10419-2-git-send-email-eric.auger@redhat.com> In-Reply-To: <1522159456-10419-1-git-send-email-eric.auger@redhat.com> References: <1522159456-10419-1-git-send-email-eric.auger@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 27 Mar 2018 14:04:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 27 Mar 2018 14:04:26 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'eric.auger@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org in case kvm_vgic_map_resources() fails, typically if the vgic distributor is not defined, __kvm_vgic_destroy will be called several times. Indeed kvm_vgic_map_resources() is called on first vcpu run. As a result dist->spis is freeed more than once and on the second time it causes a "kernel BUG at mm/slub.c:3912!" Set dist->spis to NULL to avoid the crash. Signed-off-by: Eric Auger --- virt/kvm/arm/vgic/vgic-init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c index 743ca5c..3349f2b 100644 --- a/virt/kvm/arm/vgic/vgic-init.c +++ b/virt/kvm/arm/vgic/vgic-init.c @@ -325,6 +325,7 @@ static void kvm_vgic_dist_destroy(struct kvm *kvm) dist->initialized = false; kfree(dist->spis); + dist->spis = NULL; dist->nr_spis = 0; if (vgic_supports_direct_msis(kvm)) -- 2.5.5