From c631fcb494c6cdc019ccb671bf0a940e0896e3a8 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 18 Jul 2014 09:14:55 -0700 Subject: [PATCH] igb_uio: add missing locking to config access Access to PCI config space should be inside pci_cfg_access_lock to avoid read/modify/write races. Signed-off-by: Stephen Hemminger Acked-by: Thomas Monjalon --- lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c index bca412b19b..a94d998548 100644 --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c @@ -166,10 +166,13 @@ store_extended_tag(struct device *dev, 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, @@ -180,6 +183,7 @@ store_extended_tag(struct device *dev, 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; } -- 2.20.1