lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210323182428.GA584698@bjorn-Precision-5520>
Date:   Tue, 23 Mar 2021 13:24:28 -0500
From:   Bjorn Helgaas <helgaas@...nel.org>
To:     Zhiqiang Liu <liuzhiqiang26@...wei.com>
Cc:     rjw@...ysocki.net, lenb@...nel.org, bhelgaas@...gle.com,
        linux-acpi@...r.kernel.org, linux-pci@...r.kernel.org,
        linux-kernel@...r.kernel.org, linfeilong <linfeilong@...wei.com>,
        "wubo (T)" <wubo40@...wei.com>
Subject: Re: [PATCH] pci: fix memory leak when virtio pci hotplug

On Sun, Mar 21, 2021 at 11:29:30PM +0800, Zhiqiang Liu wrote:
> From: Feilong Lin <linfeilong@...wei.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@...wei.com>
> Reviewed-by: Zhiqiang Liu <liuzhiqiang26@...wei.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
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ