DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>, stable@dpdk.org
Subject: [PATCH v2 1/7] graph: fix double close of pcapng file
Date: Wed,  2 Dec 2026 09:49:39 -0800	[thread overview]
Message-ID: <20261202175028.4071813-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20261202175028.4071813-1-stephen@networkplumber.org>

If adding an interface to the capture file failed, the error path
called rte_pcapng_close(), which closes the file descriptor,
and then closed the same descriptor again.

Only close the descriptor directly if rte_pcapng_fdopen() failed.

Fixes: df5908c98abc ("graph: fix pcapng file support")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/graph/graph_pcap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/graph/graph_pcap.c b/lib/graph/graph_pcap.c
index 78859ec2d4..07678d967d 100644
--- a/lib/graph/graph_pcap.c
+++ b/lib/graph/graph_pcap.c
@@ -128,11 +128,13 @@ graph_pcap_file_open(const char *filename)
 done:
 	return 0;
 error:
+	/* once rte_pcapng_fdopen() succeeds, the fd is closed by rte_pcapng_close() */
 	if (pcapng_fd != NULL) {
 		rte_pcapng_close(pcapng_fd);
 		pcapng_fd = NULL;
+	} else {
+		close(fd);
 	}
-	close(fd);
 	return -1;
 }
 
-- 
2.53.0


  reply	other threads:[~2026-12-02 17:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 22:41 [PATCH 0/7] pcapng: fixes, timestamps and stdio output Stephen Hemminger
2026-12-01 22:41 ` [PATCH 1/7] graph: fix double close of pcapng file Stephen Hemminger
2026-12-01 22:41 ` [PATCH 2/7] pcapng: call writev as needed on highly segmented mbuf Stephen Hemminger
2026-12-01 22:41 ` [PATCH 3/7] eal: add function to convert TSC to epoch time Stephen Hemminger
2026-12-01 22:41 ` [PATCH 4/7] pcapng: use EAL TSC to epoch conversion Stephen Hemminger
2026-12-01 22:41 ` [PATCH 5/7] pcapng: add user-supplied timestamp support Stephen Hemminger
2026-12-01 22:41 ` [PATCH 6/7] test/pcapng: compare timestamps in one clock domain Stephen Hemminger
2026-12-01 22:41 ` [PATCH 7/7] pcapng: use stdio for output Stephen Hemminger
2026-12-02 17:49 ` [PATCH v2 0/7] pcapng: fixes, timestamps and stdio output Stephen Hemminger
2026-12-02 17:49   ` Stephen Hemminger [this message]
2026-12-02 17:49   ` [PATCH v2 2/7] pcapng: call writev as needed on highly segmented mbuf Stephen Hemminger
2026-12-02 17:49   ` [PATCH v2 3/7] eal: add function to convert TSC to epoch time Stephen Hemminger
2026-12-02 17:49   ` [PATCH v2 4/7] pcapng: use EAL TSC to epoch conversion Stephen Hemminger
2026-12-02 17:49   ` [PATCH v2 5/7] pcapng: add user-supplied timestamp support Stephen Hemminger
2026-12-02 17:49   ` [PATCH v2 6/7] test/pcapng: compare timestamps in one clock domain Stephen Hemminger
2026-12-02 17:49   ` [PATCH v2 7/7] pcapng: use stdio for output Stephen Hemminger

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=20261202175028.4071813-2-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --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