From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BC9EC433C1 for ; Mon, 22 Mar 2021 02:44:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0D4A961878 for ; Mon, 22 Mar 2021 02:44:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229786AbhCVCn6 (ORCPT ); Sun, 21 Mar 2021 22:43:58 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:14119 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229613AbhCVCnt (ORCPT ); Sun, 21 Mar 2021 22:43:49 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4F3f0G3krZz19Gm7; Mon, 22 Mar 2021 10:41:50 +0800 (CST) Received: from [10.174.177.87] (10.174.177.87) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.498.0; Mon, 22 Mar 2021 10:43:37 +0800 Subject: Re: [PATCH] pci: fix memory leak when virtio pci hotplug To: Zhiqiang Liu , , , CC: , , , linfeilong References: From: Wu Bo Message-ID: <768d4a60-7442-fbdd-9c00-cc927a54d340@huawei.com> Date: Mon, 22 Mar 2021 10:43:37 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.2.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.87] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On 2021/3/21 23:29, Zhiqiang Liu wrote: > From: Feilong Lin > > Repeated hot-plugging of pci devices for a virtual > machine driven by virtio, we found that there is a > leak in kmalloc-4k, which was confirmed as the memory > of the pci_device structure. Then we found out that > it was missing pci_dev_put() after pci_get_slot() in > enable_slot() of acpiphp_glue.c. > > Signed-off-by: Feilong Lin > Reviewed-by: Zhiqiang Liu > --- > drivers/pci/hotplug/acpiphp_glue.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c > index 3365c93abf0e..f031302ad401 100644 > --- a/drivers/pci/hotplug/acpiphp_glue.c > +++ b/drivers/pci/hotplug/acpiphp_glue.c > @@ -533,6 +533,7 @@ static void enable_slot(struct acpiphp_slot *slot, bool bridge) > slot->flags &= ~SLOT_ENABLED; > continue; > } > + pci_dev_put(dev); > } > } > Reviewed-by: Wu Bo