patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kerem Aksu <kerem.aksu@i2i-systems.com>
To: thomas@monjalon.net
Cc: linville@tuxdriver.com, dev@dpdk.org, stephen@networkplumber.org,
	Kerem Aksu <kerem.aksu@i2i-systems.com>,
	stable@dpdk.org
Subject: [PATCH v2] net/af_packet: fix crash in secondary process
Date: Fri, 12 Sep 2025 14:35:25 +0300	[thread overview]
Message-ID: <20250912113525.396070-1-kerem.aksu@i2i-systems.com> (raw)
In-Reply-To: <20250912084758.354208-1-kerem.aksu@i2i-systems.com>

dumpcap crashes when trying to capture from af_packet devices. This is
caused by allocating interface name with
strdup (i.e. malloc). Interface name is not accessible from secondary
process and causes segmentation fault. Use rte_malloc instead of
strdup to fix the issue.

Bugzilla ID: 1786
Fixes: 1b93c2aa81b4 ("net/af_packet: add interface name to internals")
Cc: stable@dpdk.org

Reported-by: Kerem Aksu <kerem.aksu@i2i-systems.com>
Signed-off-by: Kerem Aksu <kerem.aksu@i2i-systems.com>
---
 .mailmap                                  | 1 +
 drivers/net/af_packet/rte_eth_af_packet.c | 7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/.mailmap b/.mailmap
index 6303e7878e..bdb4e06dbb 100644
--- a/.mailmap
+++ b/.mailmap
@@ -824,6 +824,7 @@ Kefu Chai <tchaikov@gmail.com>
 Keiichi Watanabe <keiichiw@chromium.org>
 Keith Wiles <keith.wiles@intel.com> <keith.wiles@windriver.com>
 Kent Wires <kent.wires@intel.com>
+Kerem Aksu <kerem.aksu@i2i-systems.com>
 Keunhong Lee <dlrmsghd@gmail.com>
 Kevin Laatz <kevin.laatz@intel.com>
 Kevin Lampis <klampis@solarflare.com>
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 85bc1201b4..de7ff63527 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -525,7 +525,7 @@ eth_dev_close(struct rte_eth_dev *dev)
 		rte_free(internals->rx_queue[q].rd);
 		rte_free(internals->tx_queue[q].rd);
 	}
-	free(internals->if_name);
+	rte_free(internals->if_name);
 	rte_free(internals->rx_queue);
 	rte_free(internals->tx_queue);
 
@@ -875,9 +875,10 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
 		PMD_LOG_ERRNO(ERR, "%s: ioctl failed (SIOCGIFINDEX)", name);
 		goto free_internals;
 	}
-	(*internals)->if_name = strdup(pair->value);
+	(*internals)->if_name = rte_malloc_socket(name, ifnamelen + 1, 0, numa_node);
 	if ((*internals)->if_name == NULL)
 		goto free_internals;
+	strlcpy((*internals)->if_name, pair->value, ifnamelen + 1);
 	(*internals)->if_index = ifr.ifr_ifindex;
 
 	if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) == -1) {
@@ -1063,7 +1064,7 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
 free_internals:
 	rte_free((*internals)->rx_queue);
 	rte_free((*internals)->tx_queue);
-	free((*internals)->if_name);
+	rte_free((*internals)->if_name);
 	rte_free(*internals);
 	return -1;
 }
-- 
2.34.1


-- 
Yasal Uyarı: *Bu elektronik posta bu linki kullanarak ulaşabileceğiniz 
koşullara tabidir:** **https://i2i-systems.com/email-disclaimer/ 
<http://i2i-systems.com/about-us/email-disclaimer/>*

  parent reply	other threads:[~2025-09-12 11:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-12  8:47 [PATCH] " Kerem Aksu
2025-09-12  9:32 ` Thomas Monjalon
2025-09-12 11:14   ` Kerem Aksu
2025-09-12 11:35 ` Kerem Aksu [this message]
2025-09-12 15:29   ` [PATCH v2] " 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=20250912113525.396070-1-kerem.aksu@i2i-systems.com \
    --to=kerem.aksu@i2i-systems.com \
    --cc=dev@dpdk.org \
    --cc=linville@tuxdriver.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    /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;
as well as URLs for NNTP newsgroup(s).