[dpdk-stable] patch 'bus/pci: fix Intel IOMMU sysfs access check' has been queued to LTS release 18.11.6

Kevin Traynor ktraynor at redhat.com
Fri Nov 22 15:41:12 CET 2019


Hi,

FYI, your patch has been queued to LTS release 18.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/29/19. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/a87111e546a52f567b0bc9df129d89f4738e2932

Thanks.

Kevin.

---
>From a87111e546a52f567b0bc9df129d89f4738e2932 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Tue, 13 Aug 2019 08:38:22 -0700
Subject: [PATCH] bus/pci: fix Intel IOMMU sysfs access check

[ upstream commit 2e8d5cf7631cbc5efb4b3abf7393d2526dee0424 ]

Just open the sysfs file and handle failure, rather than using access().
This eliminates Coverity warnings about TOCTOU
"time of check versus time of use"; although for this sysfs file that is
not really an issue anyway.

Coverity issue: 347276
Fixes: 54a328f552ff ("bus/pci: forbid IOVA mode if IOMMU address width too small")

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Reviewed-by: David Marchand <david.marchand at redhat.com>
---
 drivers/bus/pci/linux/pci.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 74794a3ba..9b1c7c839 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -593,16 +593,17 @@ pci_one_device_iommu_support_va(struct rte_pci_device *dev)
 		 rte_pci_get_sysfs_path(), addr->domain, addr->bus, addr->devid,
 		 addr->function);
-	if (access(filename, F_OK) == -1) {
-		/* We don't have an Intel IOMMU, assume VA supported*/
-		return true;
-	}
 
-	/* We have an intel IOMMU */
 	fp = fopen(filename, "r");
 	if (fp == NULL) {
-		RTE_LOG(ERR, EAL, "%s(): can't open %s\n", __func__, filename);
+		/* We don't have an Intel IOMMU, assume VA supported */
+		if (errno == ENOENT)
+			return true;
+
+		RTE_LOG(ERR, EAL, "%s(): can't open %s: %s\n",
+			__func__, filename, strerror(errno));
 		return false;
 	}
 
+	/* We have an Intel IOMMU */
 	if (fscanf(fp, "%" PRIx64, &vtd_cap_reg) != 1) {
 		RTE_LOG(ERR, EAL, "%s(): can't read %s\n", __func__, filename);
-- 
2.21.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-11-22 14:36:56.618889629 +0000
+++ 0026-bus-pci-fix-Intel-IOMMU-sysfs-access-check.patch	2019-11-22 14:36:55.194149350 +0000
@@ -1 +1 @@
-From 2e8d5cf7631cbc5efb4b3abf7393d2526dee0424 Mon Sep 17 00:00:00 2001
+From a87111e546a52f567b0bc9df129d89f4738e2932 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 2e8d5cf7631cbc5efb4b3abf7393d2526dee0424 ]
+
@@ -13 +14,0 @@
-Cc: stable at dpdk.org
@@ -22 +23 @@
-index 1ac2bff77..318db1953 100644
+index 74794a3ba..9b1c7c839 100644
@@ -25 +26 @@
-@@ -512,16 +512,17 @@ pci_device_iommu_support_va(const struct rte_pci_device *dev)
+@@ -593,16 +593,17 @@ pci_one_device_iommu_support_va(struct rte_pci_device *dev)



More information about the stable mailing list