From patchwork Tue Sep 13 10:20:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 9329187 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 B3C9660231 for ; Tue, 13 Sep 2016 14:06:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5EE7294D1 for ; Tue, 13 Sep 2016 14:06:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A8F7294E5; Tue, 13 Sep 2016 14:06:35 +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 B1691294D1 for ; Tue, 13 Sep 2016 14:06:31 +0000 (UTC) Received: from localhost ([::1]:49110 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjoM2-0002Rw-V9 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 13 Sep 2016 10:06:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjkqW-0003aC-E2 for qemu-devel@nongnu.org; Tue, 13 Sep 2016 06:21:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjkqQ-0001Na-S3 for qemu-devel@nongnu.org; Tue, 13 Sep 2016 06:21:43 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34291) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjkqQ-0001If-LK for qemu-devel@nongnu.org; Tue, 13 Sep 2016 06:21:38 -0400 Received: by mail-wm0-f65.google.com with SMTP id g141so6592709wmd.1 for ; Tue, 13 Sep 2016 03:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:cc:subject:date; bh=k2/sG/BR/O82n3ReR703RDe5lY1GJJXKIuqqm1+d2qM=; b=j4ui6sunLIKqHe+RvK4e8LS19EiTEqr0bQsPpHknqoJMtNl9sPKX1OGJ1DpKtLX/w5 QhbopopRKUoD7AyJ5DFs9jDDO9fT4mjfvBbPqT7fkdo9vrnkE6jlvwlHYsyQgw6ZR/kb qc0ZZ07BdQxLuD/awq4FsG04c0gxW+kKjIa3xDGCYQBZ4G53uMVmvbmmKL4r6oMz0eZY DU209oMhjmEoQ8KdpaTn9v0hwNPXQscIsOcmxJF0Z7RCQMnMoCRq4Ua0dYCwwaEzFfeq mVL+v7sxsWQ88DN6ls3R2ikVH5RvFzvjt9jTtlfDcuknPvTWvkcDfKduC9IF0d+2sRix jWeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:from:to:cc:subject:date; bh=k2/sG/BR/O82n3ReR703RDe5lY1GJJXKIuqqm1+d2qM=; b=C7uJUGw27PZN8gkRJD0XFntDA0br8wTTXkfK+uYh4o+ITf3pwtxDvonNTypl+dLHRO Kf3uOE51VTMuflOsIq8W8f4wNFiOvQlVjDO0IkGIAhvIMQlt//cax75ZKponj+ORaANB JdgAuP+9MpeRNgFTm/lKows8pSa/zF18ZfXryNxQqKXcXZ06SorO0UTZhCpXTpL1jACz uxQBJXZNg6dCwFJeo5oAODrqM84hWs+P6y/YB+8tTsLTDmIU7HSBTmu2XTwxtOh8jp2p 64tlbswu/E9H0S3Afrw/z5y1HQ1bAW+tUITk2noNFT8MRa5+Ovrq/ZT8nOxuGhJwyN9F l8/A== X-Gm-Message-State: AE9vXwOvRjYdoTJ1Xq121zH8G8ATk79fbaw5sMFqNpxy1CMcPOHqvNuuLbqE6uCc+Dls6g== X-Received: by 10.28.23.210 with SMTP id 201mr14535757wmx.108.1473762016883; Tue, 13 Sep 2016 03:20:16 -0700 (PDT) Received: from localhost.localdomain.localdomain ([104.192.110.250]) by smtp.gmail.com with ESMTPSA id w203sm4560148wmw.7.2016.09.13.03.20.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Sep 2016 03:20:16 -0700 (PDT) Message-ID: <57d7d2e0.d4301c0a.d13e9.9a55@mx.google.com> X-Google-Original-Message-ID: <1473762003-12943-1-git-send-email-Qiang(liqiang6-s@360.cn)> From: Li Qiang X-Google-Original-From: Li Qiang(liqiang6-s@360.cn) To: kraxel@redhat.com, qemu-devel@nongnu.org Date: Tue, 13 Sep 2016 03:20:03 -0700 X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.65 X-Mailman-Approved-At: Tue, 13 Sep 2016 09:54:10 -0400 Subject: [Qemu-devel] [PATCH v2] usb:xhci:fix memory leak in usb_xhci_exit 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 Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Li Qiang If the xhci uses msix, it doesn't free the corresponding memory, thus leading a memory leak. This patch avoid this. Signed-off-by: Li Qiang --- hw/usb/hcd-xhci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 188f954..281a2a5 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -3709,8 +3709,7 @@ static void usb_xhci_exit(PCIDevice *dev) /* destroy msix memory region */ if (dev->msix_table && dev->msix_pba && dev->msix_entry_used) { - memory_region_del_subregion(&xhci->mem, &dev->msix_table_mmio); - memory_region_del_subregion(&xhci->mem, &dev->msix_pba_mmio); + msix_uninit(dev, &xhci->mem, &xhci->mem); } usb_bus_release(&xhci->bus);