Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4060312pxf; Tue, 23 Mar 2021 01:16:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQsV7S2l2iftgTtcPeUYSVKa9gNsZJkXlKETnYPiFWFUhJUeTcQ6RhzaxqjHDn6e6xzJ7Z X-Received: by 2002:a17:906:5e50:: with SMTP id b16mr3850848eju.272.1616487376002; Tue, 23 Mar 2021 01:16:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616487375; cv=none; d=google.com; s=arc-20160816; b=nZNunVUoVhKZqg4zrMZbjOW53RhmBNOK5Vd/DBdGQb8VoAhmEl79qpIQafkwC7CUTl 51Q/S/SS2gMWYf40OSetr191O8LUjHJ02hVONYK4IHBJuA+1ja/OquoWaa/eFg1pPoIm GEeQO9+vA62QxlJt/o0OWU/WGnT5lrqj0Fgl077xgR1eZpWQsY22XgCiNUD0RadZj8Yv c+DnfMXWcOmz+k4tZcfENO67kizD76aOUjLeTDR7ShQi9zrnqfZDXFWpvg5fe05BbEXK uyUj4Ps3DplP/KkMW6IOMmqTvYTGEImhwKb6a7haUAxAwD95RfOfmEEkcQOo+Gve67UT 7I+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=TDluqrPASx8AIwSHX1Bh+jN7QFWn2bTH7KShcZvvt2Q=; b=Q3QqvO/Z0a1VwTw2Y+clTcik5l6GhV35umrRYqFH9PIa4DT5sdEvz/eXGab0kvoDUq 0Dq8DFFhQjM0NPP7/IMWcFwmrXDI/LrCaqKngMslyA1M3jLWInPkcsOcRiEe7vB5awIo eKSvLiUvPDpzTdsEdGNYT9pOL0csYbeJWntOChD54dU7VitecOow9On8oLitwLYNmygm SoCYoZjolWFx9LueZoS6AqKmRhXwxwJDZYFopEiq7BNxFyMvR6GqhjjpSdnEKZUQGzdU BwVKehnqcVoat00BxFR9CZeuBw0UzHK6TZqFqz+1bsrBPqjXFJLm/E55fa+Vnk9yS2rh LacA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c10si13183710edv.12.2021.03.23.01.15.53; Tue, 23 Mar 2021 01:16:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229920AbhCWIOr (ORCPT + 99 others); Tue, 23 Mar 2021 04:14:47 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:14012 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229854AbhCWIOR (ORCPT ); Tue, 23 Mar 2021 04:14:17 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4F4PH00ggbzrTb9; Tue, 23 Mar 2021 16:12:12 +0800 (CST) Received: from [127.0.0.1] (10.174.176.117) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Tue, 23 Mar 2021 16:14:03 +0800 Subject: Re: [PATCH] pci: fix memory leak when virtio pci hotplug To: Wu Bo , , , CC: , , , linfeilong References: <768d4a60-7442-fbdd-9c00-cc927a54d340@huawei.com> From: Zhiqiang Liu Message-ID: Date: Tue, 23 Mar 2021 16:14:03 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <768d4a60-7442-fbdd-9c00-cc927a54d340@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [10.174.176.117] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org friendly ping.. On 2021/3/22 10:43, Wu Bo wrote: > 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 > > .