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: [PATCH 2/5] eal/freebsd: fix a FD leak in the alarm subsystem
Date: Fri, 2 Oct 2026 11:17:55 +0200 [thread overview]
Message-ID: <20261002091758.2922227-3-david.marchand@redhat.com> (raw)
In-Reply-To: <20261002091758.2922227-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>
Acked-by: Bruce Richardson <bruce.richardson@intel.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-10-02 9:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 9:17 [PATCH 0/5] Interrupts API update David Marchand
2026-10-02 9:17 ` [PATCH 1/5] vdpa/mlx5: fix check on err interrupt FD David Marchand
2026-10-02 9:17 ` David Marchand [this message]
2026-10-02 9:17 ` [PATCH 3/5] interrupts: mark file descriptors invalid on allocation David Marchand
2026-10-02 9:17 ` [PATCH 4/5] interrupts: close interrupt FDs David Marchand
2026-10-02 9:17 ` [PATCH 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=20261002091758.2922227-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox