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: <20250422230534.2295291-3-alex.williamson@redhat.com>
Date: Tue, 22 Apr 2025 17:05:32 -0600
From: Alex Williamson <alex.williamson@...hat.com>
To: bhelgaas@...gle.com,
	rafael@...nel.org
Cc: Alex Williamson <alex.williamson@...hat.com>,
	linux-pci@...r.kernel.org,
	linux-pm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] PCI: Increment PM usage counter when probing reset methods

We can get different results probing reset methods for a device
depending on its power state.  For example, reading the PM control
register of a device in D3cold will always indicate NoSoftRst+,
preventing us from correctly probing PM reset support.

Increment the PM usage counter before any probes and use the cleanup
__free facility to automatically drop the usage counter out of scope.

Signed-off-by: Alex Williamson <alex.williamson@...hat.com>
---
 drivers/pci/pci-sysfs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index c6cda56ca52c..71a36f57ef57 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1475,6 +1475,9 @@ static ssize_t reset_method_store(struct device *dev,
 		return count;
 	}
 
+	pm_runtime_get_sync(dev);
+	struct device *pmdev __free(pm_runtime_put) = dev;
+
 	if (sysfs_streq(buf, "default")) {
 		pci_init_reset_methods(pdev);
 		return count;
-- 
2.48.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ