patch 'bus/pci/bsd: fix device existence check' has been queued to stable release 23.11.5
Xueming Li
xuemingl at nvidia.com
Thu Jun 26 14:01:37 CEST 2025
Hi,
FYI, your patch has been queued to stable release 23.11.5
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/28/25. 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://git.dpdk.org/dpdk-stable/log/?h=23.11-staging
This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=74a2941c3ba5886ca89f73df018798978757e96d
Thanks.
Xueming Li <xuemingl at nvidia.com>
---
>From 74a2941c3ba5886ca89f73df018798978757e96d Mon Sep 17 00:00:00 2001
From: Jake Freeland <jfree at freebsd.org>
Date: Tue, 6 May 2025 12:40:44 -0500
Subject: [PATCH] bus/pci/bsd: fix device existence check
Cc: Xueming Li <xuemingl at nvidia.com>
[ upstream commit 6d4e6dbccc3bd965bfd5e5836d7cb21c1b1f9c6c ]
Use open(2) instead of access(2) to check for the existence of the target
device. This avoids a possible race condition where the device file is
removed after a successful call to access(2) but before open(2).
This also fixes any potential bugs associated with passing open(2)-style
flags into access(2). i.e. access(2) does not formally support the O_RDWR
flag.
Fixes: 764bf26873b9 ("add FreeBSD support")
Signed-off-by: Jake Freeland <jfree at freebsd.org>
Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
drivers/bus/pci/bsd/pci.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 27f12590d4..933a43a9f5 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -105,20 +105,27 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
{
char devname[PATH_MAX]; /* contains the /dev/uioX */
struct rte_pci_addr *loc;
+ int fd;
loc = &dev->addr;
snprintf(devname, sizeof(devname), "/dev/uio at pci:%u:%u:%u",
dev->addr.bus, dev->addr.devid, dev->addr.function);
- if (access(devname, O_RDWR) < 0) {
- RTE_LOG(WARNING, EAL, " "PCI_PRI_FMT" not managed by UIO driver, "
- "skipping\n", loc->domain, loc->bus, loc->devid, loc->function);
- return 1;
+ fd = open(devname, O_RDWR);
+ if (fd < 0) {
+ if (errno == ENOENT) {
+ RTE_LOG(WARNING, EAL, " "PCI_PRI_FMT" not managed by UIO driver, "
+ "skipping\n", loc->domain, loc->bus, loc->devid, loc->function);
+ return 1;
+ }
+ RTE_LOG(ERR, EAL, "Failed to open device file for " PCI_PRI_FMT " (%s)",
+ loc->domain, loc->bus, loc->devid, loc->function, devname);
+ return -1;
}
/* save fd if in primary process */
- if (rte_intr_fd_set(dev->intr_handle, open(devname, O_RDWR))) {
+ if (rte_intr_fd_set(dev->intr_handle, fd)) {
RTE_LOG(WARNING, EAL, "Failed to save fd");
goto error;
}
--
2.34.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2025-06-26 19:59:20.627862309 +0800
+++ 0077-bus-pci-bsd-fix-device-existence-check.patch 2025-06-26 19:59:17.506418039 +0800
@@ -1 +1 @@
-From 6d4e6dbccc3bd965bfd5e5836d7cb21c1b1f9c6c Mon Sep 17 00:00:00 2001
+From 74a2941c3ba5886ca89f73df018798978757e96d Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 6d4e6dbccc3bd965bfd5e5836d7cb21c1b1f9c6c ]
@@ -15 +17,0 @@
-Cc: stable at dpdk.org
@@ -24 +26 @@
-index 2508e36a85..3f13e1d6ac 100644
+index 27f12590d4..933a43a9f5 100644
@@ -27 +29 @@
-@@ -106,20 +106,27 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
+@@ -105,20 +105,27 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
@@ -39,2 +41,2 @@
-- PCI_LOG(WARNING, " "PCI_PRI_FMT" not managed by UIO driver, skipping",
-- loc->domain, loc->bus, loc->devid, loc->function);
+- RTE_LOG(WARNING, EAL, " "PCI_PRI_FMT" not managed by UIO driver, "
+- "skipping\n", loc->domain, loc->bus, loc->devid, loc->function);
@@ -45,2 +47,2 @@
-+ PCI_LOG(WARNING, PCI_PRI_FMT" not managed by UIO driver, skipping",
-+ loc->domain, loc->bus, loc->devid, loc->function);
++ RTE_LOG(WARNING, EAL, " "PCI_PRI_FMT" not managed by UIO driver, "
++ "skipping\n", loc->domain, loc->bus, loc->devid, loc->function);
@@ -49 +51 @@
-+ PCI_LOG(ERR, "Failed to open device file for " PCI_PRI_FMT " (%s)",
++ RTE_LOG(ERR, EAL, "Failed to open device file for " PCI_PRI_FMT " (%s)",
@@ -57 +59 @@
- PCI_LOG(WARNING, "Failed to save fd");
+ RTE_LOG(WARNING, EAL, "Failed to save fd");
More information about the stable
mailing list