Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp831766ybi; Fri, 12 Jul 2019 05:23:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxyyEh4NZVHEjSNz48l+juN1Td5zBanlHW3FqymXX8fKEAov2/j8/CsoY0rVZdL4FFzlADO X-Received: by 2002:a17:902:e282:: with SMTP id cf2mr11250553plb.301.1562934195911; Fri, 12 Jul 2019 05:23:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562934195; cv=none; d=google.com; s=arc-20160816; b=aTdcFXMLrnJ/9MJw/hDb4gy2DPhEtg/VbpwGlnFcCTYwZnEPuwvM6b63LdAsMXL1bb zkoqu/RmejWXro7cW+ecRlSXMHl3c+9xPRWdjMaeF+jEJ3rB/4dnRNx9D6Kga814RE3S B+7llF/WQ7pDCbt3hphqPVmLqbQKEgTGvxvF11jGJ/tF7I30yWZ83yqFcuBl/ZCGbXtk VBbcWu+jZogtrYyyfTWJFxgvc+7ZrEudBhGzMsBiSdQw6c4xIHTBjXgDA2PdeDMiFIbb 4lW/9I8ei+vImIHyJArKg/iaLeZArnLf+kXe3RG+gYIfR7sX6OkkQ4kNnFVnVq8Rb+q/ /pfg== 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=oHy2ry7UU/3j64P9ba5C5JV8DmkU6ESTY9onA+Y1NAE=; b=io8uFpVAfYAJzda8oXIPn7gz+9PMwCipA16lz5GRrjU2OcU3eL6Few+mAuypNWaiwd GRKWsf4Wdf+fEwNL8nsg/hiro6fzvl/4qyNCgjkFlJ4pLUrxZ6XcKApEQfhrP4n/DqCQ ak73nYfaFE/isiqKUzqsLSX08eNcpuDmnwc3qZTclA4iYfLVzOjF/vLfhEfdfMgG+5J/ aWPzeoVCVDuoALBT/xyYFJWO7xk15lsuZ112rbOA7Nlxh6bbo6iBzfvl7g1EUD0OMQqs T3NP7W7e+YWWtQQPkXDzHBgqnTtiO3XHdwx8Tg0mrSBzg9zksEbeQDa1+kqigYUCbtU/ c2JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QFrcT5DX; 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 m99si7976886pjb.107.2019.07.12.05.23.00; Fri, 12 Jul 2019 05:23:15 -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=QFrcT5DX; 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 S1727519AbfGLMVE (ORCPT + 99 others); Fri, 12 Jul 2019 08:21:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:54830 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727510AbfGLMVC (ORCPT ); Fri, 12 Jul 2019 08:21:02 -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 D814321019; Fri, 12 Jul 2019 12:21:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934061; bh=hDyiUh6yXYCaTJEpS8mUYx6g9K9zu2m8R4RaQQTtOoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QFrcT5DX6h9EU5sAddKz5HMjJR9HKesmcG8KW2Vkbrybfl3fNgJqfxAPxVEoBZxcC pIvtgpXkuiBNE0WglBynVAW9qUoxOk5iKKynIukL/7SCuHssHNYfbSvPMNjBihVgxj bvw98ahSNcjxiD1bUA63jpnaH02CJa+i/fD+ZlKc= 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 4.19 32/91] KVM: arm/arm64: vgic: Fix kvm_device leak in vgic_its_destroy Date: Fri, 12 Jul 2019 14:18:35 +0200 Message-Id: <20190712121623.084507105@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121621.422224300@linuxfoundation.org> References: <20190712121621.422224300@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 621bb004067e..0dbe332eb343 100644 --- a/virt/kvm/arm/vgic/vgic-its.c +++ b/virt/kvm/arm/vgic/vgic-its.c @@ -1750,6 +1750,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 */ } int vgic_its_has_attr_regs(struct kvm_device *dev, -- 2.20.1