aboutsummaryrefslogtreecommitdiff
path: root/lib/test_fortify/write_overflow-strncpy-src.c
diff options
context:
space:
mode:
authorFeiyang Chen <[email protected]>2023-08-24 09:37:38 +0800
committerBjorn Helgaas <[email protected]>2023-08-25 16:17:11 -0500
commit5694ba13b004eea683c6d4faeb6d6e7a9636bda0 (patch)
tree974e42d48d40a7204b8d89467077d3d7ad408d87 /lib/test_fortify/write_overflow-strncpy-src.c
parent06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5 (diff)
PCI/PM: Only read PCI_PM_CTRL register when available
For a device with no Power Management Capability, pci_power_up() previously returned 0 (success) if the platform was able to put the device in D0, which led to pci_set_full_power_state() trying to read PCI_PM_CTRL, even though it doesn't exist. Since dev->pm_cap == 0 in this case, pci_set_full_power_state() actually read the wrong register, interpreted it as PCI_PM_CTRL, and corrupted dev->current_state. This led to messages like this in some cases: pci 0000:01:00.0: Refused to change power state from D3hot to D0 To prevent this, make pci_power_up() always return a negative failure code if the device lacks a Power Management Capability, even if non-PCI platform power management has been able to put the device in D0. The failure will prevent pci_set_full_power_state() from trying to access PCI_PM_CTRL. Fixes: e200904b275c ("PCI/PM: Split pci_power_up()") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Feiyang Chen <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: "Rafael J. Wysocki" <[email protected]> Cc: [email protected] # v5.19+
Diffstat (limited to 'lib/test_fortify/write_overflow-strncpy-src.c')
0 files changed, 0 insertions, 0 deletions