Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp850887ybi; Fri, 12 Jul 2019 05:42:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4meicxyA2QBKivFryfCGNgCmBuZuxKCdbC/qhzzb85TBCsoR92FdHAQWok26xbki9VRam X-Received: by 2002:a17:902:8f87:: with SMTP id z7mr11085221plo.65.1562935325824; Fri, 12 Jul 2019 05:42:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562935325; cv=none; d=google.com; s=arc-20160816; b=LIp/sVt0d26mmeC8HGMwBuoTtgf5r/r0obHon2a+tdZO5gj24IKNQQYgaQE55XvlX6 vI3Soc8F/PPw4MmjNAeFVaKqqBqTtn5IrPcDRpRdLupWFEDNfDAI1WXuDln5RVVGjgd2 6+hmoFHpLaGFiRJ9edCyX8wdn5RVs+AznLV3WnDfc6n89LoQaJK6HzKAHH0IwWPuFUbd 7iWUBLLzimF6h2aiHInnbfij1Z4o/iaRjQ13bU57uDOD9DD72CYl99UrdwsuUFvYxBgl o9guuGyzk5pTTLgyhi2ehsDImSDhYyxxNXKe4Z+AbF9PExPqrW3udHPwBJ78ca7YoqAa m/cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SCetnf3ei1UstBDQNpMJRhnHi4qgo7B1P9UFouuZ8dA=; b=zwKOrOta6TssBOV92Uh+bF44xasJh/IPvABk5X11a1qStQcIOHBsSYn1l6SLzeqZCb 9XNdFdJyaNDdiNNCE8o3Ydt0BGbo84UjxwclbqKN5iziIULsveq1G5IGen763AMiptZ1 r5//i12MZZuRXaoYHrZJdSJUgcdZyPnC/fV9FSk1I0k0lo8LvnX115uFPREQ4FtPHelI L+aSZsnPwh16lPdCzbeUQgyBJl86VuF3ar2oCVhP0BJd0gKDPbBOssHBqLuEpimoWRDz xVnxns7uJV/JDVGhvepPQGdIV/9mYGjC/zb94d1y+DlZ8Iec38sIlbpE7Vhb9UGR7zN5 5/+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=avU34lyM; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si7537357plp.96.2019.07.12.05.41.50; Fri, 12 Jul 2019 05:42:05 -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; dkim=pass header.i=@kernel.org header.s=default header.b=avU34lyM; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728281AbfGLMje (ORCPT + 99 others); Fri, 12 Jul 2019 08:39:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:39110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727027AbfGLM1G (ORCPT ); Fri, 12 Jul 2019 08:27:06 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6962621019; Fri, 12 Jul 2019 12:27:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934425; bh=OPkQS4ZouFSkR3LiI4mp1tcYx6W9URNFMKjcq5dTkVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=avU34lyMvTqOBCCMpiyqnW1GzRNMSIxC+VG1R0rK8Bl6+sBdyVhGHqnO7491TslP2 GICxGNjr1HO6kN5FaU7DHBEsVgESgV8Zd7Z6ZXL/bA/W0gHfQn621YdCkxgLBEpRja LMf2HDX7ozC8gVsrIP3Zlvd6Klzxe+cpnNAfeSrg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andre Przywara , Dave Martin , Marc Zyngier , Sasha Levin Subject: [PATCH 5.1 051/138] KVM: arm/arm64: vgic: Fix kvm_device leak in vgic_its_destroy Date: Fri, 12 Jul 2019 14:18:35 +0200 Message-Id: <20190712121630.622450958@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121628.731888964@linuxfoundation.org> References: <20190712121628.731888964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 4729ec8c1e1145234aeeebad5d96d77f4ccbb00a ] kvm_device->destroy() seems to be supposed to free its kvm_device struct, but vgic_its_destroy() is not currently doing this, resulting in a memory leak, resulting in kmemleak reports such as the following: unreferenced object 0xffff800aeddfe280 (size 128): comm "qemu-system-aar", pid 13799, jiffies 4299827317 (age 1569.844s) [...] backtrace: [<00000000a08b80e2>] kmem_cache_alloc+0x178/0x208 [<00000000dcad2bd3>] kvm_vm_ioctl+0x350/0xbc0 Fix it. Cc: Andre Przywara Fixes: 1085fdc68c60 ("KVM: arm64: vgic-its: Introduce new KVM ITS device") Signed-off-by: Dave Martin Signed-off-by: Marc Zyngier Signed-off-by: Sasha Levin --- virt/kvm/arm/vgic/vgic-its.c | 1 + 1 file changed, 1 insertion(+) diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c index 44ceaccb18cf..8c9fe831bce4 100644 --- a/virt/kvm/arm/vgic/vgic-its.c +++ b/virt/kvm/arm/vgic/vgic-its.c @@ -1734,6 +1734,7 @@ static void vgic_its_destroy(struct kvm_device *kvm_dev) mutex_unlock(&its->its_lock); kfree(its); + kfree(kvm_dev);/* alloc by kvm_ioctl_create_device, free by .destroy */ } static int vgic_its_has_attr_regs(struct kvm_device *dev, -- 2.20.1