mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-09 22:14:36 -04:00
x86/pci: Comment pci_mmconfig_insert() obscure MCFG dependency
In pci_mmconfig_insert(), there's no reference to "addr" between locking pci_mmcfg_lock and testing "addr", so it *looks* like we should move the test before the lock. But07f9b61c39("x86/PCI: MMCONFIG: Check earlier for MMCONFIG region at address zero") did that, which broke things by returning -EINVAL when "addr" is zero instead of -EEXIST. So07f9b61c39was reverted by67d470e0e1("Revert "x86/PCI: MMCONFIG: Check earlier for MMCONFIG region at address zero""). Add a comment about this issue to prevent it from happening again. Link: https://lore.kernel.org/r/20231121183643.249006-8-helgaas@kernel.org Tested-by: Tomasz Pala <gotar@polanet.pl> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
@@ -786,6 +786,10 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
|
||||
return -EEXIST;
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't move earlier; we must return -EEXIST, not -EINVAL, if
|
||||
* pci_mmconfig_lookup() finds something
|
||||
*/
|
||||
if (!addr) {
|
||||
mutex_unlock(&pci_mmcfg_lock);
|
||||
return -EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user