Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp49981pxf; Wed, 24 Mar 2021 20:39:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0rLMnSMIuMdtO3iOVZTuyejeslweCVpFXK4ZHEpO6+NdkUg9uCMW6P7l0pQ+Xmz3Uw5vm X-Received: by 2002:aa7:db15:: with SMTP id t21mr6766072eds.145.1616643541064; Wed, 24 Mar 2021 20:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616643541; cv=none; d=google.com; s=arc-20160816; b=to7cQJh6gZ+Ar2jQjlijB9tBkKzrU3WwfuIZyrO+dsPXXqt4ws2FSZ6bXpsUzdqYIb sm7TF2gwNVshth9YHKiS/I64axJ+SmbFpUDxUyJ01fvn8a6jyKgTzycT4wsTeIO30Rix Dqfb/bRWTEWsiQLdwS95drVRu/lQpZrDVPFot9SHka2I/ZZUsLeP+YrIwqPWWfNubFn+ 9cwJZAlKyyx0U5NXQyNYwJlyUL4HI09OB5q7L2kLdAw5aTfy9e8b8W1dynGJKd5mP8Z5 sp7MhuZJdJaetKVp/dqDei6PHZ0Q9eG6LJOnuwFVr+ZMZlNt7qsDxGy4xgtReZi1hjYu 3a9Q== 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=dQ7Y3mPtRQMEAAj7ciyu8o3sfkndSiPrzxbF/3WMrQw=; b=U30gwsd27FJlYq8AgG2zPVSOF4ie/wxDq7ugFyafXhpf9lqgXu2EGmWZEFI50Ychzt GmrCEGVocFm34a7sGvuf/4yLMdYcA5b+EJ83C2Q3ddRhaLKQufbT/WSv++85rap3Js77 gvjdeXGBQ43W3lddTwNDmTVa5QwqCBQjxEmlPK8S69UcohT1klr6ECHEzTGxm6fsX8iJ s73P4JLXwkJ54+45Hj5LP44/O8wSGR2jZ1a0VCyH2XY4wuajuCUVL0jrAcb7maTtY1Ue Inp81BoXrflHqdBZ3/N5kMluo2o6HoXg/l/o70RHK2Buba4hOf+k1gh9xGKfjGMRobVC D6tw== 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 a3si3171187ejv.34.2021.03.24.20.38.39; Wed, 24 Mar 2021 20:39:01 -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 S239429AbhCYAxT (ORCPT + 99 others); Wed, 24 Mar 2021 20:53:19 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:14523 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239410AbhCYAwt (ORCPT ); Wed, 24 Mar 2021 20:52:49 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4F5RN70KM8zNqRl; Thu, 25 Mar 2021 08:50:15 +0800 (CST) Received: from [127.0.0.1] (10.174.176.117) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.498.0; Thu, 25 Mar 2021 08:52:39 +0800 Subject: Re: [PATCH] pci: fix memory leak when virtio pci hotplug To: Bjorn Helgaas CC: , , , , , , linfeilong , "wubo (T)" References: <20210323182428.GA584698@bjorn-Precision-5520> From: Zhiqiang Liu Message-ID: Date: Thu, 25 Mar 2021 08:52:38 +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: <20210323182428.GA584698@bjorn-Precision-5520> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 Thanks for your suggestion. I will rewrite the commit log and send the v2 patch. On 2021/3/24 2:24, Bjorn Helgaas wrote: > On Sun, Mar 21, 2021 at 11:29:30PM +0800, 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 > Since this came from you, Zhiqiang, it needs a signed-off-by (not just > a reviewed-by) from you. See > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=v5.11#n361 > > Also see > https://lore.kernel.org/r/20171026223701.GA25649@bhelgaas-glaptop.roam.corp.google.com > and > > - Wrap commit log to fill 80 columns > - s/pci/PCI/ (subject and commit log) > - Run "git log --oneline drivers/pci/hotplug/acpiphp_glue.c". It's > not completely consistent, but at least match the style of one of > them. > > There is no "pci_device" structure. I think you mean the "struct > pci_dev". > > The commit log doesn't actually say what the patch does. It's obvious > from the patch, but it should say in the commit log. Look at previous > commit logs to see how they do it. > >> --- >> 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); >> } >> } >> >> -- >> 2.19.1 >> >> > .