Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Zhiqiang Liu <liuzhiqiang26@huawei.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: <rjw@rjwysocki.net>, <lenb@kernel.org>, <bhelgaas@google.com>,
	<linux-acpi@vger.kernel.org>, <linux-pci@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	linfeilong <linfeilong@huawei.com>,
	"wubo (T)" <wubo40@huawei.com>
Subject: Re: [PATCH] pci: fix memory leak when virtio pci hotplug
Date: Thu, 25 Mar 2021 08:52:38 +0800	[thread overview]
Message-ID: <e2e405d3-a9a6-807d-dc7a-d6596214fbe9@huawei.com> (raw)
In-Reply-To: <20210323182428.GA584698@bjorn-Precision-5520>

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 <linfeilong@huawei.com>
>>
>> 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 <linfeilong@huawei.com>
>> Reviewed-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
> 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
>>
>>
> .


      reply	other threads:[~2021-03-25  0:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-21 15:29 [PATCH] pci: fix memory leak when virtio pci hotplug Zhiqiang Liu
2021-03-22  2:43 ` Wu Bo
2021-03-23  8:14   ` Zhiqiang Liu
2021-03-23 18:24 ` Bjorn Helgaas
2021-03-25  0:52   ` Zhiqiang Liu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e2e405d3-a9a6-807d-dc7a-d6596214fbe9@huawei.com \
    --to=liuzhiqiang26@huawei.com \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linfeilong@huawei.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=wubo40@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox