Commit 4d87a6e
committed
PCI/ASPM: Fix link state exit during switch upstream function removal
JIRA: https://issues.redhat.com/browse/RHEL-102694
commit cbf937d
Author: Daniel Stodden <daniel.stodden@gmail.com>
Date: Sun, 22 Dec 2024 19:39:08 -0800
Before 456d8aa ("PCI/ASPM: Disable ASPM on MFD function removal to
avoid use-after-free"), we would free the ASPM link only after the last
function on the bus pertaining to the given link was removed.
That was too late. If function 0 is removed before sibling function,
link->downstream would point to free'd memory after.
After above change, we freed the ASPM parent link state upon any function
removal on the bus pertaining to a given link.
That is too early. If the link is to a PCIe switch with MFD on the upstream
port, then removing functions other than 0 first would free a link which
still remains parent_link to the remaining downstream ports.
The resulting GPFs are especially frequent during hot-unplug, because
pciehp removes devices on the link bus in reverse order.
On that switch, function 0 is the virtual P2P bridge to the internal bus.
Free exactly when function 0 is removed -- before the parent link is
obsolete, but after all subordinate links are gone.
Link: https://lore.kernel.org/r/e12898835f25234561c9d7de4435590d957b85d9.1734924854.git.dns@arista.com
Fixes: 456d8aa ("PCI/ASPM: Disable ASPM on MFD function removal to avoid use-after-free")
Signed-off-by: Daniel Stodden <dns@arista.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
[kwilczynski: commit log]
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
Signed-off-by: Marcin Juszkiewicz <mjuszkiewicz@redhat.com>1 parent 025775a commit 4d87a6e
1 file changed
+9
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1270 | 1270 | | |
1271 | 1271 | | |
1272 | 1272 | | |
1273 | | - | |
1274 | | - | |
1275 | | - | |
1276 | | - | |
| 1273 | + | |
| 1274 | + | |
1277 | 1275 | | |
1278 | | - | |
1279 | | - | |
1280 | | - | |
1281 | | - | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
1282 | 1279 | | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
1283 | 1283 | | |
1284 | 1284 | | |
1285 | 1285 | | |
| |||
1290 | 1290 | | |
1291 | 1291 | | |
1292 | 1292 | | |
| 1293 | + | |
1293 | 1294 | | |
1294 | 1295 | | |
1295 | 1296 | | |
| |||
0 commit comments