From: Kerem Aksu <kerem.aksu@i2i-systems.com>
To: linville@tuxdriver.com
Cc: dev@dpdk.org, thomas@monjalon.net, ciwillia@brocade.com,
stephen@networkplumber.org,
Kerem Aksu <kerem.aksu@i2i-systems.com>,
stable@dpdk.org
Subject: [PATCH] net/af_packet: fix crash in secondary process
Date: Fri, 12 Sep 2025 11:47:58 +0300 [thread overview]
Message-ID: <20250912084758.354208-1-kerem.aksu@i2i-systems.com> (raw)
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 | 9 ++++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/.mailmap b/.mailmap
index 73d573e400..fadf873d4f 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..6928fc200f 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,12 @@ 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_zmalloc_socket(name, ifnamelen + 1,
+ 0, numa_node);
if ((*internals)->if_name == NULL)
goto free_internals;
+ memcpy((*internals)->if_name, pair->value, ifnamelen);
+ (*internals)->if_name[ifnamelen] = '\0';
(*internals)->if_index = ifr.ifr_ifindex;
if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) == -1) {
@@ -1063,7 +1066,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/>*
next reply other threads:[~2025-09-12 8:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-12 8:47 Kerem Aksu [this message]
2025-09-12 9:32 ` Thomas Monjalon
2025-09-12 11:14 ` Kerem Aksu
2025-09-12 11:35 ` [PATCH v2] " Kerem Aksu
2025-09-12 15:29 ` 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=20250912084758.354208-1-kerem.aksu@i2i-systems.com \
--to=kerem.aksu@i2i-systems.com \
--cc=ciwillia@brocade.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).