Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3111764pxf; Sun, 21 Mar 2021 19:45:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyK2idYb8z9YzXJNWRicCcDFwANgAA4hcQiXRw7hSXEQkY7V7u8SMq8P9R5TtPle4dSvqmD X-Received: by 2002:a17:907:d1b:: with SMTP id gn27mr5833500ejc.227.1616381151473; Sun, 21 Mar 2021 19:45:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616381151; cv=none; d=google.com; s=arc-20160816; b=cJ4qEOOBCHi0Zih8kGZm0QwzM4JoPnm4Z85xWIpoPTrimXMniPXOQFMibm/eVE7Gh8 A2pdjV0RD5Q5GSlvnh64okcS3dlZngouvQLHOagKjagIZK20toyN5LVdGCCk1xKbTzV/ /U6a/kLXr83RzDqb55xenSWLAhE9YBefDo/a3HTT1gtBwkIpLC19fUHSAzWjk+vLnq2P z1SZfQfFR+aqzKryf365Ygz9ycWIHfSEtGESBGpXgTqknOGEJEJtMSI36IdQALHpu3W4 vNX5wY59pVbLBtVbS/PCfx4ECKPxxgjmjnc6z4xY6DZcVWxHDEYzFaW+g4ihmU/503yg 5k1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=uIBpTGtKPhyG0S8fjeVI2QveO47BIQBQnFNnB8JRnac=; b=P6IamusPJ+p1UWifZhe32L6++Y+sr2IR9N6fF8gE6/mt2C/SR+EqWZoX+ulx/9Gg+l LeLl3WgNAKAwvyGEy9MaVDsl/bwjvw7zrLs08MnJie7mm2pQiObjJCW6oM+2AMOieiUU 2uhLX0+pKL7S4FI9LhkXEJ3VHbW8rqfc4M1VdS9ddx9TEKnjeqmAVNBsRTi4ZRoUiShJ bctDMU95NSjLYdeXSbGi1mw3pJ8yEqXkI3+A+4yeyZRhszb35GGPaVKmPvIRRtGUlern 8+SpSIYSRMhnFfGyp09g2LUnGf42GB9xiENp6MAh5hb28H14iznrmL/cWnauxTArY2Ak UT1Q== 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 n7si10577956ejc.483.2021.03.21.19.45.28; Sun, 21 Mar 2021 19:45:51 -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 S229913AbhCVCoA (ORCPT + 99 others); Sun, 21 Mar 2021 22:44:00 -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-kernel@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