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: <CAEEQ3wmaD61DMV0nXrQeVEk6r-J3JYxFceXZmH=t0aQrESqJew@mail.gmail.com>
Date: Tue, 18 Feb 2025 16:31:40 +0800
From: yunhui cui <cuiyunhui@...edance.com>
To: Shuai Xue <xueshuai@...ux.alibaba.com>
Cc: renyu.zj@...ux.alibaba.com, will@...nel.org, mark.rutland@....com, 
	linux-arm-kernel@...ts.infradead.org, linux-perf-users@...r.kernel.org, 
	linux-kernel@...r.kernel.org, Bjorn Helgaas <bhelgaas@...gle.com>, 
	Jonathan Cameron <Jonathan.Cameron@...wei.com>, linux-pci@...r.kernel.org
Subject: Re: [External] Re: [PATCH v3 1/2] perf/dwc_pcie: fix some unreleased resources

Hi Shuai,

On Tue, Feb 11, 2025 at 4:05 PM Shuai Xue <xueshuai@...ux.alibaba.com> wrote:
>
>
>
> 在 2025/2/8 18:40, Yunhui Cui 写道:
> > Release leaked resources, such as plat_dev and dev_info.
> >
> > Signed-off-by: Yunhui Cui <cuiyunhui@...edance.com>
> > ---
> >   drivers/perf/dwc_pcie_pmu.c | 33 ++++++++++++++++++++++-----------
> >   1 file changed, 22 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/perf/dwc_pcie_pmu.c b/drivers/perf/dwc_pcie_pmu.c
> > index cccecae9823f..19fa2ba8dd67 100644
> > --- a/drivers/perf/dwc_pcie_pmu.c
> > +++ b/drivers/perf/dwc_pcie_pmu.c
> > @@ -572,8 +572,10 @@ static int dwc_pcie_register_dev(struct pci_dev *pdev)
> >               return PTR_ERR(plat_dev);
> >
> >       dev_info = kzalloc(sizeof(*dev_info), GFP_KERNEL);
> > -     if (!dev_info)
> > +     if (!dev_info) {
> > +             platform_device_unregister(plat_dev);
> >               return -ENOMEM;
> > +     }
> >
> >       /* Cache platform device to handle pci device hotplug */
> >       dev_info->plat_dev = plat_dev;
> > @@ -730,6 +732,15 @@ static struct platform_driver dwc_pcie_pmu_driver = {
> >       .driver = {.name = "dwc_pcie_pmu",},
> >   };
> >
> > +static void dwc_pcie_cleanup_devices(void)
> > +{
> > +     struct dwc_pcie_dev_info *dev_info, *tmp;
> > +
> > +     list_for_each_entry_safe(dev_info, tmp, &dwc_pcie_dev_info_head, dev_node) {
> > +             dwc_pcie_unregister_dev(dev_info);
> > +     }
> > +}
> > +
> >   static int __init dwc_pcie_pmu_init(void)
> >   {
> >       struct pci_dev *pdev = NULL;
> > @@ -742,7 +753,7 @@ static int __init dwc_pcie_pmu_init(void)
> >               ret = dwc_pcie_register_dev(pdev);
> >               if (ret) {
> >                       pci_dev_put(pdev);
>
> Should we get a reference count of pdev in dwc_pcie_register_dev and put it in
> dwc_pcie_unregister_dev?

Personally, it's not an issue because RP devices are generally not unloaded.

>
> Thanks.
> Shuai
>

Thanks,
Yunhui

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ