From: Long Li <longli@microsoft.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, david.marchand@redhat.com,
Long Li <longli@microsoft.com>
Subject: [PATCH v2] eal: return error on devargs truncation in hotplug MP messages
Date: Tue, 23 Jun 2026 17:05:31 -0700 [thread overview]
Message-ID: <20260624000531.1562655-1-longli@microsoft.com> (raw)
In-Reply-To: <20260325014506.1866374-1-longli@microsoft.com>
The EAL hotplug multi-process messaging uses a fixed-size buffer
(EAL_DEV_MP_DEV_ARGS_MAX_LEN, 128 bytes) for device arguments.
When devargs exceeds this limit, strlcpy silently truncates the
string. This causes secondary processes to receive incomplete
devargs during hotplug re-add, leading to failed port
re-initialization.
For example, a MANA PCI device with 6 mac= arguments:
mac=AA:BB:CC:DD:EE:01,mac=AA:BB:CC:DD:EE:02,
mac=AA:BB:CC:DD:EE:03,mac=AA:BB:CC:DD:EE:04,
mac=AA:BB:CC:DD:EE:05,mac=AA:BB:CC:DD:EE:06
produces a 131-byte devargs string that gets silently truncated
to 127 bytes, losing the last MAC address.
Return -E2BIG from rte_dev_probe() when devargs would be truncated,
instead of silently corrupting data. rte_dev_remove() does not need
the same check because the length was already validated at probe time.
Fixes: 244d5130719c ("eal: enable hotplug on multi-process")
Cc: stable@dpdk.org
Signed-off-by: Long Li <longli@microsoft.com>
---
v2:
- Added Fixes: tag and Cc: stable@dpdk.org.
- Moved the length check before memset() in rte_dev_probe().
- Removed the redundant length check from rte_dev_remove();
devargs length is already validated at probe time.
- Dropped the [2/2] meson-options patch from this series; it will
be sent separately.
lib/eal/common/eal_common_dev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 48b631532a..f3fc4d585e 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -271,6 +271,12 @@ rte_dev_probe(const char *devargs)
struct rte_device *dev;
int ret;
+ if (strlen(devargs) >= EAL_DEV_MP_DEV_ARGS_MAX_LEN) {
+ EAL_LOG(ERR, "devargs truncated (len %zu, max %d)",
+ strlen(devargs), EAL_DEV_MP_DEV_ARGS_MAX_LEN);
+ return -E2BIG;
+ }
+
memset(&req, 0, sizeof(req));
req.t = EAL_DEV_REQ_TYPE_ATTACH;
strlcpy(req.devargs, devargs, EAL_DEV_MP_DEV_ARGS_MAX_LEN);
--
2.43.0
prev parent reply other threads:[~2026-06-24 0:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 1:45 [PATCH 1/2] eal: return error on devargs truncation in hotplug MP messages Long Li
2026-03-25 1:45 ` [PATCH 2/2] eal: add meson options for hotplug MP message buffer sizes Long Li
2026-03-25 2:44 ` Stephen Hemminger
2026-03-25 18:42 ` [EXTERNAL] " Long Li
2026-06-09 9:30 ` [PATCH 1/2] eal: return error on devargs truncation in hotplug MP messages David Marchand
2026-06-24 0:06 ` [EXTERNAL] " Long Li
2026-06-24 0:05 ` Long Li [this message]
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=20260624000531.1562655-1-longli@microsoft.com \
--to=longli@microsoft.com \
--cc=david.marchand@redhat.com \
--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