From patchwork Thu Nov 24 12:30:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 9445401 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ED3596075F for ; Thu, 24 Nov 2016 12:30:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0465E27F4B for ; Thu, 24 Nov 2016 12:30:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED38827F80; Thu, 24 Nov 2016 12:30:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8D8C827F4B for ; Thu, 24 Nov 2016 12:30:58 +0000 (UTC) Received: from localhost ([::1]:39421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9tB3-0007MQ-1U for patchwork-qemu-devel@patchwork.kernel.org; Thu, 24 Nov 2016 07:30:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9tAX-0007M7-Tr for qemu-devel@nongnu.org; Thu, 24 Nov 2016 07:30:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9tAW-0000uH-PM for qemu-devel@nongnu.org; Thu, 24 Nov 2016 07:30:25 -0500 Received: from mail-oi0-x244.google.com ([2607:f8b0:4003:c06::244]:33133) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c9tAW-0000tu-Ja for qemu-devel@nongnu.org; Thu, 24 Nov 2016 07:30:24 -0500 Received: by mail-oi0-x244.google.com with SMTP id f201so2901782oib.0 for ; Thu, 24 Nov 2016 04:30:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=w04mS0xHi+fgSP6pD7y58WcoL4D+ooUy0TV7PJMy9zQ=; b=EBQakwYpX+II+jEr+V+B/3NdCGiJjW0RfPW3QWlXkiTqIaIQTntiI9Jl/guHShzEj/ NLuB6Gu+H6PaMV6fcpFTAAD5vsdZEQAYXZKgVxKMEtpB5/2AU3Y0/z1mKaD/Yh1tIf99 mnwnXl1vB06YER8kqBCcvEH68oPEjp8azbZ8EKicD0uTPq0kcoz4o4q5jzDDs56jQY7t NOrWoCWf363KIhAUGPur3hDH/oHHbmmPWxpJFxw9Rj6D73NE1CIhHnb8Pb6OedYruVo1 b0Q9ksf3KACmjflqJxK5BgguLMchPn42njSrOBKpyBCI8ywgB+P0C1aT53n8fSVzxwkl m96A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=w04mS0xHi+fgSP6pD7y58WcoL4D+ooUy0TV7PJMy9zQ=; b=f8BCg4qVOqOyEcROhHAGz5H7ZUe2Zp0t+E6fs/1QTuZfWvdBTnypuR6l42+q/VUIUW K3NYSioRdkzElFy5Fr8UXTtdRcTb140mDs6GGBQIRoxHZwlGHac1ZYyC9UxbMJubgcdD UinxFkuRJm0JsAf2JhzsabPmA1gSD6QoP4K8UDGKK2QIWZ/eZF2xok5HQxBD/MzreucS 7uQd6FOKyVKT07RLpL8m1TyGiJAvc5wXdoifzDnxDGDEWmGfTcjnqBmGGV5kjRUSjju5 F8UFS/MdbfDFSRv8umHHnCz3tzOo8jrstPlUrwgF6rlREEyoOvg+y7yP/VJEJFz12h95 94rw== X-Gm-Message-State: AKaTC03X2dZFlA+MA4MxDpKxd4jUyI98LryZitR28G6eY7xc7KcHvC/0mN105CzJX7d3yQ== X-Received: by 10.202.220.139 with SMTP id t133mr1146897oig.176.1479990624019; Thu, 24 Nov 2016 04:30:24 -0800 (PST) Received: from localhost.localdomain ([104.192.110.250]) by smtp.gmail.com with ESMTPSA id 66sm11572528oid.29.2016.11.24.04.30.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Nov 2016 04:30:23 -0800 (PST) From: Li Qiang To: kraxel@redhat.com, marcandre.lureau@gmail.com, qemu-devel@nongnu.org Date: Thu, 24 Nov 2016 07:30:09 -0500 Message-Id: <1479990609-28243-3-git-send-email-liq3ea@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1479990609-28243-1-git-send-email-liq3ea@gmail.com> References: <1479990609-28243-1-git-send-email-liq3ea@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::244 Subject: [Qemu-devel] [PATCH 2/2] virtio-gpu: call cleanup mapping function in resource destroy X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Qiang , liqiang6-s@360.cn Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP If the guest destroy the resource before detach banking, the 'iov' and 'addrs' field in resource is not freed thus leading memory leak issue. This patch avoid this. Signed-off-by: Li Qiang Reviewed-by: Marc-André Lureau --- hw/display/virtio-gpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index cc725a6..98dadf2 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -360,6 +360,7 @@ static void virtio_gpu_resource_destroy(VirtIOGPU *g, struct virtio_gpu_simple_resource *res) { pixman_image_unref(res->image); + virtio_gpu_cleanup_mapping(res); QTAILQ_REMOVE(&g->reslist, res, next); g_free(res); }