ehci_take_control() can infinite loop due to PCI invalid reads
As part of testing the recent ACPI changes, a user hit an issue where we found an infinite loop in ehci_take_contrl().
The purpose of this function is to try and prod the BIOS to take control of the USB stack and devices. As part of trying to find this it looks through the pci configuration space in the classic PCI extension fashion. Unfortunately, if we hit an invalid read, we end up infinite looping as a result as we'll pretty much always have another capability which is the same invalid read.
The fix is simple, when we read PCI_EINAVL32, we should break out of the loop.
I tested this in a few ways: I worked with the user who was seeing this in the context of the new ACPI bits and verified that they no longer saw the hang. I also tested this on some other systems with EHCI and made sure that we still correctly found the capability and worked through it correctly.
Updated by Electric Monk over 2 years ago
- Status changed from New to Closed
commit 9a48f6c443e5968307491ba7cc134bbdd0328801 Author: Robert Mustacchi <email@example.com> Date: 2018-09-22T15:05:38.000Z 9806 ehci_take_control() can infinite loop due to PCI invalid reads Reviewed by: Dan McDonald <firstname.lastname@example.org> Reviewed by: Jason King <email@example.com> Reviewed by: Patrick Mooney <firstname.lastname@example.org> Reviewed by: Toomas Soome <email@example.com> Reviewed by: Garrett D'Amore <firstname.lastname@example.org> Approved by: Richard Lowe <email@example.com>