Commit 2a0f0df
PCI/sysfs: Ensure devices are powered for config reads
commit 48991e4 upstream.
The "max_link_width", "current_link_speed", "current_link_width",
"secondary_bus_number", and "subordinate_bus_number" sysfs files all access
config registers, but they don't check the runtime PM state. If the device
is in D3cold or a parent bridge is suspended, we may see -EINVAL, bogus
values, or worse, depending on implementation details.
Wrap these access in pci_config_pm_runtime_{get,put}() like most of the
rest of the similar sysfs attributes.
Notably, "max_link_speed" does not access config registers; it returns a
cached value since d2bd39c ("PCI: Store all PCIe Supported Link
Speeds").
Fixes: 56c1af4 ("PCI: Add sysfs max_link_speed/width, current_link_speed/width, etc")
Signed-off-by: Brian Norris <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
Signed-off-by: Bjorn Helgaas <[email protected]>
Cc: [email protected]
Link: https://patch.msgid.link/20250924095711.v2.1.Ibb5b6ca1e2c059e04ec53140cd98a44f2684c668@changeid
Signed-off-by: Greg Kroah-Hartman <[email protected]>1 parent 9a4f8f6 commit 2a0f0df
1 file changed
+19
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
199 | 200 | | |
200 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
201 | 207 | | |
202 | 208 | | |
203 | 209 | | |
| |||
209 | 215 | | |
210 | 216 | | |
211 | 217 | | |
| 218 | + | |
212 | 219 | | |
| 220 | + | |
| 221 | + | |
213 | 222 | | |
214 | 223 | | |
215 | 224 | | |
| |||
226 | 235 | | |
227 | 236 | | |
228 | 237 | | |
| 238 | + | |
229 | 239 | | |
| 240 | + | |
| 241 | + | |
230 | 242 | | |
231 | 243 | | |
232 | 244 | | |
| |||
242 | 254 | | |
243 | 255 | | |
244 | 256 | | |
| 257 | + | |
245 | 258 | | |
| 259 | + | |
| 260 | + | |
246 | 261 | | |
247 | 262 | | |
248 | 263 | | |
| |||
258 | 273 | | |
259 | 274 | | |
260 | 275 | | |
| 276 | + | |
261 | 277 | | |
| 278 | + | |
| 279 | + | |
262 | 280 | | |
263 | 281 | | |
264 | 282 | | |
| |||
0 commit comments