patch 'eal/linux: fix eventfd leaks when enabling interrupts' has been queued to stable release 24.11.9
luca.boccassi at gmail.com
luca.boccassi at gmail.com
Thu Nov 5 17:41:34 CET 2026
Hi,
FYI, your patch has been queued to stable release 24.11.9
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/07/26. 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/bluca/dpdk-stable
This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/de19b1f042c73cfbc9ff97c4ca29321ffe3f2541
Thanks.
Luca Boccassi
---
>From de19b1f042c73cfbc9ff97c4ca29321ffe3f2541 Mon Sep 17 00:00:00 2001
From: Anatoly Burakov <anatoly.burakov at intel.com>
Date: Fri, 23 Oct 2026 14:51:34 +0100
Subject: [PATCH] eal/linux: fix eventfd leaks when enabling interrupts
[ upstream commit 3ba6b689893fe92a92ee500b030d6ae6ad5c13f0 ]
When enabling MSI-X eventfds, a failure after creating some descriptors
leaves them open. The eventfd count is recorded only after all allocations
succeed, so disabling eventfds cannot clean up a partial allocation.
Calling enable again without disabling first also leaks descriptors by
overwriting the existing eventfd entries.
Reject repeated MSI-X enable calls with EBUSY before modifying the handle.
Update the eventfd count as each descriptor is created, so that on failure
every eventfd created by the call can be closed, its entry cleared, and the
count reset.
Fixes: b9e0662a931d ("eal/linux: add interrupt API for drivers")
Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
Acked-by: David Marchand <david.marchand at redhat.com>
---
lib/eal/linux/eal_interrupts.c | 46 +++++++++++++++++++++++++---------
1 file changed, 34 insertions(+), 12 deletions(-)
diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c
index abb717257c3..828680e24a0 100644
--- a/lib/eal/linux/eal_interrupts.c
+++ b/lib/eal/linux/eal_interrupts.c
@@ -1556,31 +1556,44 @@ rte_intr_free_epoll_fd(struct rte_intr_handle *intr_handle)
int
rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
{
- uint32_t i;
- int fd;
uint32_t n = RTE_MIN(nb_efd, (uint32_t)RTE_MAX_RXTX_INTR_VEC_ID);
+ int ret;
assert(nb_efd != 0);
if (rte_intr_type_get(intr_handle) == RTE_INTR_HANDLE_VFIO_MSIX) {
- for (i = 0; i < n; i++) {
- fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
+ if (rte_intr_nb_efd_get(intr_handle) != 0) {
+ EAL_LOG(ERR, "Interrupt eventfds are already enabled");
+ return -EBUSY;
+ }
+
+ for (uint32_t i = 0; i < n; i++) {
+ int fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
+
if (fd < 0) {
+ ret = -errno;
EAL_LOG(ERR,
"can't setup eventfd, error %i (%s)",
errno, strerror(errno));
- return -errno;
+ goto error;
}
- if (rte_intr_efds_index_set(intr_handle, i, fd))
- return -rte_errno;
+ /* Record each eventfd as it is created so that the
+ * error path can close exactly those that exist.
+ */
+ if (rte_intr_efds_index_set(intr_handle, i, fd) ||
+ rte_intr_nb_efd_set(intr_handle, i + 1)) {
+ ret = -rte_errno;
+ close(fd);
+ rte_intr_efds_index_set(intr_handle, i, -1);
+ goto error;
+ }
}
- if (rte_intr_nb_efd_set(intr_handle, n))
- return -rte_errno;
-
- if (rte_intr_max_intr_set(intr_handle, NB_OTHER_INTR + n))
- return -rte_errno;
+ if (rte_intr_max_intr_set(intr_handle, NB_OTHER_INTR + n)) {
+ ret = -rte_errno;
+ goto error;
+ }
} else if (rte_intr_type_get(intr_handle) == RTE_INTR_HANDLE_VDEV) {
/* only check, initialization would be done in vdev driver.*/
if ((uint64_t)rte_intr_efd_counter_size_get(intr_handle) >
@@ -1598,6 +1611,15 @@ rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
}
return 0;
+
+error:
+ for (int i = 0; i < rte_intr_nb_efd_get(intr_handle); i++) {
+ close(rte_intr_efds_index_get(intr_handle, i));
+ rte_intr_efds_index_set(intr_handle, i, -1);
+ }
+ rte_intr_nb_efd_set(intr_handle, 0);
+
+ return ret;
}
void
--
2.47.3
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-11-05 16:42:45.324467059 +0000
+++ 0007-eal-linux-fix-eventfd-leaks-when-enabling-interrupts.patch 2026-11-05 16:42:44.889059830 +0000
@@ -1 +1 @@
-From 3ba6b689893fe92a92ee500b030d6ae6ad5c13f0 Mon Sep 17 00:00:00 2001
+From de19b1f042c73cfbc9ff97c4ca29321ffe3f2541 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 3ba6b689893fe92a92ee500b030d6ae6ad5c13f0 ]
+
@@ -19 +20,0 @@
-Cc: stable at dpdk.org
@@ -28 +29 @@
-index fa658f5a3c..73f23c314b 100644
+index abb717257c3..828680e24a0 100644
@@ -31 +32 @@
-@@ -1556,31 +1556,44 @@ RTE_EXPORT_INTERNAL_SYMBOL(rte_intr_efd_enable)
+@@ -1556,31 +1556,44 @@ rte_intr_free_epoll_fd(struct rte_intr_handle *intr_handle)
@@ -103 +104 @@
- RTE_EXPORT_INTERNAL_SYMBOL(rte_intr_efd_disable)
+ void
More information about the stable
mailing list