From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by dpdk.org (Postfix) with ESMTP id C29B5B36E for ; Fri, 18 Jul 2014 18:14:22 +0200 (CEST) Received: by mail-pa0-f43.google.com with SMTP id lf10so5704425pab.16 for ; Fri, 18 Jul 2014 09:15:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:user-agent:date:from:to:cc:subject :references:mime-version:content-type:content-disposition; bh=o/yDghy6YjcH3tYdgM4lpSii/4245uRas9lMIdT49BE=; b=Sdcn9RfbEVTwvor19deBwQnn61EaV19U0YI8nNA+np6CLOHpF4f9CkHs+g9qg+MD48 ND+eqymSLu/L3Sy6WVLqhVHZahQOofcnb9eE0Hj/La08Y27CDCLp/+mMB7xl/zlxxmPH I9YtqwGFfv3C3qrYKzfztazzat93RQt++ctvFpDawB9UuBPAs7GYqzrIaKEtxJYR30s2 ADsZmZqJWEg7lS4U+rr/yj/Uu2vAh+iKtGZvcLS8TnOg4b+qcepCIt5A3WXM1xRL5dx9 Z0bJReWzGQXVxFAcdFWlz/UsP1TJ805CCjJGGBpNCZZGx2CKcR9Dp4r17odMH6AVe92R IzYg== X-Gm-Message-State: ALoCoQlykikre6X9MGo/5BjEEsYey2dD0H+wavq8KFcvuwSufTdbAntrhtQxChtOU6N9S7q8V7VT X-Received: by 10.68.114.65 with SMTP id je1mr6613420pbb.124.1405700123209; Fri, 18 Jul 2014 09:15:23 -0700 (PDT) Received: from localhost (static-50-53-66-61.bvtn.or.frontiernet.net. [50.53.66.61]) by mx.google.com with ESMTPSA id mw3sm7996518pdb.55.2014.07.18.09.15.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jul 2014 09:15:22 -0700 (PDT) Message-Id: <20140718161525.144095467@networkplumber.org> User-Agent: quilt/0.63-1 Date: Fri, 18 Jul 2014 09:14:55 -0700 From: Stephen Hemminger To: Thomas Monjalon References: <20140718161447.020882834@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=igb_uio-cfg-lock.patch Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH 08/10] igb_uio: add missing locking to config access X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jul 2014 16:14:23 -0000 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; }