From patchwork Tue Sep 13 05:22:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5p2O5by6?= X-Patchwork-Id: 9328379 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 BD4C76048F for ; Tue, 13 Sep 2016 05:23:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF75628EF0 for ; Tue, 13 Sep 2016 05:23:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E95029102; Tue, 13 Sep 2016 05:23:09 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 A9F9328EF0 for ; Tue, 13 Sep 2016 05:23:07 +0000 (UTC) Received: from localhost ([::1]:46577 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjgBW-0002vL-MY for patchwork-qemu-devel@patchwork.kernel.org; Tue, 13 Sep 2016 01:23:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52097) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjgB5-0002uA-4A for qemu-devel@nongnu.org; Tue, 13 Sep 2016 01:22:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjgB1-00039A-2a for qemu-devel@nongnu.org; Tue, 13 Sep 2016 01:22:39 -0400 Received: from mtabjsc2.360.cn ([123.125.82.7]:35014) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjgB0-00038E-Bb for qemu-devel@nongnu.org; Tue, 13 Sep 2016 01:22:34 -0400 Received: from CAS1.corp.qihoo.net (unknown [220.181.158.129]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mtabjsc2.360.cn (QHMAIL) with ESMTP id D1FC96B0F1F; Tue, 13 Sep 2016 13:22:28 +0800 (CST) Received: from EX02.corp.qihoo.net ([fe80::7882:7b3d:59d6:3fc7]) by CAS1.corp.qihoo.net ([220.181.158.129]) with mapi id 14.02.0387.000; Tue, 13 Sep 2016 13:22:28 +0800 From: =?gb2312?B?wO7Hvw==?= To: "kraxel@redhat.com" , "Qemu developers (qemu-devel@nongnu.org)" Thread-Topic: [PATCH] usb:xhci:fix memory leak in usb_xhci_exit Thread-Index: AdINfoOrjsWFeweEQxiGXoGCx8+17A== Date: Tue, 13 Sep 2016 05:22:27 +0000 Message-ID: <143C0AFC63FC204CB0C55BB88F3A8ABB0187F0D1@EX02.corp.qihoo.net> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.18.213.35] MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 123.125.82.7 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: [Qemu-devel] [PATCH] 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP If the xhci uses msix, it doesn't free the corresponding memory, thus leading a memory leak issue. 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); -- 1.8.3.1