patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Kerem Aksu <kerem.aksu@i2i-systems.com>
Cc: linville@tuxdriver.com, dev@dpdk.org, ciwillia@brocade.com,
	stephen@networkplumber.org, stable@dpdk.org
Subject: Re: [PATCH] net/af_packet: fix crash in secondary process
Date: Fri, 12 Sep 2025 11:32:02 +0200	[thread overview]
Message-ID: <3299441.5fSG56mABF@thomas> (raw)
In-Reply-To: <20250912084758.354208-1-kerem.aksu@i2i-systems.com>

12/09/2025 10:47, Kerem Aksu:
> 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.

I agree with the analysis, thank you.

[...]
> -	(*internals)->if_name = strdup(pair->value);
> +	(*internals)->if_name = rte_zmalloc_socket(name, ifnamelen + 1,
> +									0, numa_node);

Probably no need to go on the next line, you are allowed to go to 100 characters per line.
If a second line is needed, only 2 tabs are required.

Why zmalloc? Probably no need to zero it.

>  	if ((*internals)->if_name == NULL)
>  		goto free_internals;
> +	memcpy((*internals)->if_name, pair->value, ifnamelen);
> +	(*internals)->if_name[ifnamelen] = '\0';

We can use a string-specialized function, like strlcpy.



  reply	other threads:[~2025-09-12  9:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-12  8:47 Kerem Aksu
2025-09-12  9:32 ` Thomas Monjalon [this message]
2025-09-12 11:14   ` Kerem Aksu
2025-09-12 11:35 ` [PATCH v2] " Kerem Aksu
2025-09-12 15:29   ` Stephen Hemminger
2025-09-12 17:01   ` Thomas Monjalon

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=3299441.5fSG56mABF@thomas \
    --to=thomas@monjalon.net \
    --cc=ciwillia@brocade.com \
    --cc=dev@dpdk.org \
    --cc=kerem.aksu@i2i-systems.com \
    --cc=linville@tuxdriver.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.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;
as well as URLs for NNTP newsgroup(s).