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: <cnbtk5ziotlksmmledv6hyugpn6zpvyrjlogtkg6sspaw5qcas@humkwz6o5xf6>
Date: Wed, 16 Jul 2025 21:27:55 +0530
From: Manivannan Sadhasivam <mani@...nel.org>
To: Brian Norris <briannorris@...omium.org>
Cc: Bartosz Golaszewski <brgl@...ev.pl>, 
	Bjorn Helgaas <bhelgaas@...gle.com>, linux-pci@...r.kernel.org, Rob Herring <robh@...nel.org>, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] PCI/pwrctrl: Only destroy alongside host bridge

On Tue, Jul 15, 2025 at 02:21:47PM GMT, Brian Norris wrote:
> Hi Manivannan,
> 
> Thanks for reviewing.
> 
> On Sat, Jul 12, 2025 at 10:56:38PM +0530, Manivannan Sadhasivam wrote:
> > If you take a look at commit f1536585588b ("PCI: Don't rely on
> > of_platform_depopulate() for reused OF-nodes"), you can realize that the PCI
> > core clears OF_POPULATED flag while removing the PCI device. So
> > of_platform_device_destroy() will do nothing.
> 
> I've looked through that commit several times, and while I think I
> understand its claim, I really haven't been able to validate it. I've
> inspected the code for anything like of_node_clear_flag(nc,
> OF_POPULATED), and the closest I see for any PCI-relevant code is in
> drivers/of/platform.c -- mostly in error paths (undoing device creation)
> or of_platform_device_destroy() or of_platform_depopulate().
> 
> I've also tried quite a bit of tracing / printk'ing, and I can't find
> the OF_POPULATED getting cleared either.
> 
> Is there any chance there's a mistake in the claims in commit
> f1536585588b? e.g., maybe Bartosz was looking at OF_POPULATED_BUS (which
> is different, but also relevant to his change)? Or am I missing
> something obvious in here?
> 

Now, I did look into the OF code and I also couldn't see where exactly the
OF_POPULATED flag is getting cleared by the PCI core :/ So I'll defer the
question to Bartosz.

> OTOH, I also see that part of my change is not really doing quite what I
> thought it was -- so far, I think there may be some kind of resource
> leak (kobj ref), since I'm not seeing pci_release_host_bridge_dev()
> called when I think it should be. If I perform cleanup in
> pci_free_host_bridge() instead, then I do indeed see
> of_platform_device_destroy() tear things down the way I expect.
> 

Oh, that's bad! Which controller it is? I played with making the pcie-qcom
driver modular and I unloaded/loaded multiple times, but never saw any
refcount warning (I really hope if there was any leak, it would've tripped over
during insmod).

- Mani

-- 
மணிவண்ணன் சதாசிவம்

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ