From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org, hkalra@marvell.com
Cc: stable@dpdk.org, Bruce Richardson <bruce.richardson@intel.com>,
Anatoly Burakov <anatoly.burakov@intel.com>
Subject: [RFC v4 2/5] eal/freebsd: fix a FD leak in the alarm subsystem
Date: Tue, 8 Sep 2026 09:38:31 +0200 [thread overview]
Message-ID: <20260908073835.3422310-3-david.marchand@redhat.com> (raw)
In-Reply-To: <20260908073835.3422310-1-david.marchand@redhat.com>
Caught by code review, while looking at rte_intr_instance_free() users.
Even if the FD is not used, it must still be closed when uninitialising
the alarm subsystem.
Fixes: 26021a715067 ("eal/bsd: support alarm API")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changes since RFC v3:
- fixed compilation,
---
lib/eal/freebsd/eal_alarm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/eal/freebsd/eal_alarm.c b/lib/eal/freebsd/eal_alarm.c
index c03e281e67..8544fe8d03 100644
--- a/lib/eal/freebsd/eal_alarm.c
+++ b/lib/eal/freebsd/eal_alarm.c
@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include <unistd.h>
#include <errno.h>
#include <eal_export.h>
@@ -54,6 +55,8 @@ rte_eal_alarm_cleanup(void)
int ret = rte_intr_callback_unregister_sync(intr_handle,
eal_alarm_callback, (void *)-1);
if (ret >= 0) {
+ close(rte_intr_fd_get(intr_handle));
+ rte_intr_fd_set(intr_handle, -1);
rte_intr_instance_free(intr_handle);
intr_handle = NULL;
}
@@ -62,7 +65,7 @@ rte_eal_alarm_cleanup(void)
int
rte_eal_alarm_init(void)
{
- int fd;
+ int fd = -1;
intr_handle = rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_PRIVATE);
if (intr_handle == NULL) {
@@ -88,6 +91,8 @@ rte_eal_alarm_init(void)
return 0;
error:
+ if (fd >= 0)
+ close(fd);
rte_intr_instance_free(intr_handle);
return -1;
}
--
2.54.0
next prev parent reply other threads:[~2026-09-08 7:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 7:38 [RFC v4 0/5] Interrupts API update David Marchand
2026-09-08 7:38 ` [RFC v4 1/5] vdpa/mlx5: fix check on err interrupt FD David Marchand
2026-09-11 9:18 ` Dariusz Sosnowski
2026-09-08 7:38 ` David Marchand [this message]
2026-09-08 7:51 ` [RFC v4 2/5] eal/freebsd: fix a FD leak in the alarm subsystem Bruce Richardson
2026-09-08 7:38 ` [RFC v4 3/5] interrupts: mark file descriptors invalid on allocation David Marchand
2026-09-08 7:38 ` [RFC v4 4/5] interrupts: close interrupt FDs David Marchand
2026-09-08 7:38 ` [RFC v4 5/5] interrupts: warn on leaked file descriptors David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260908073835.3422310-3-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=anatoly.burakov@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=hkalra@marvell.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.