Access to PCI config space should be inside pci_cfg_access_lock
to avoid read/modify/write races.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
else
return -EINVAL;
+ pci_cfg_access_lock(pci_dev);
pci_bus_read_config_dword(pci_dev->bus, pci_dev->devfn,
PCI_DEV_CAP_REG, &val);
- if (!(val & PCI_DEV_CAP_EXT_TAG_MASK)) /* Not supported */
+ if (!(val & PCI_DEV_CAP_EXT_TAG_MASK)) { /* Not supported */
+ pci_cfg_access_unlock(pci_dev);
return -EPERM;
+ }
val = 0;
pci_bus_read_config_dword(pci_dev->bus, pci_dev->devfn,
val &= ~PCI_DEV_CTRL_EXT_TAG_MASK;
pci_bus_write_config_dword(pci_dev->bus, pci_dev->devfn,
PCI_DEV_CTRL_REG, val);
+ pci_cfg_access_unlock(pci_dev);
return count;
}