From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: [PATCH 08/10] igb_uio: add missing locking to config access Date: Fri, 18 Jul 2014 09:14:55 -0700 Message-ID: <20140718161525.144095467@networkplumber.org> References: <20140718161447.020882834@networkplumber.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Cc: dev-VfR2kkLFssw@public.gmane.org To: Thomas Monjalon Return-path: Content-Disposition: inline; filename=igb_uio-cfg-lock.patch List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" Access to PCI config space should be inside pci_cfg_access_lock to avoid read/modify/write races. Signed-off-by: Stephen Hemminger --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c 2014-06-19 14:55:03.959554076 -0700 +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c 2014-06-19 14:58:55.000000000 -0700 @@ -148,10 +148,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, @@ -162,6 +165,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; }