From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH 0/4] fix crash on device args with no driver options
Date: Mon, 5 Oct 2026 09:53:46 -0700 [thread overview]
Message-ID: <20261005165512.334085-1-stephen@networkplumber.org> (raw)
A device given in the global syntax with no driver layer, such as
"bus=vdev,name=net_af_packet0", leaves devargs args NULL because
drv_str shares a union with it and is never set. The legacy syntax
always sets args, to an empty string when there are no options, and
drivers rely on that. Passing the NULL to rte_kvargs_parse() crashes
in strdup().
The first patch makes the global syntax match the legacy one by
defaulting to an empty string. The second hardens rte_kvargs_parse()
so a NULL gives an empty list rather than a crash; NULL is not
excluded by the API documentation, and an empty list is the sensible
reading of "no arguments".
The last two patches add the missing coverage. There was no test for
a device string without driver arguments, which is how this went
unnoticed. Converting the devargs test to the unit test suite runner
comes first so the new case is reported on its own rather than
short-circuiting the rest of the file.
Verified both new tests fail without the fixes: the devargs case trips
its args-NULL assertion, and the kvargs case faults in strdup().
Bugzilla ID: 2049
Stephen Hemminger (4):
devargs: fix NULL args with global device syntax
kvargs: harden rte_kvargs_parse
test/devargs: use unit test suite runner
test/devargs: add tests for missing device arguments
app/test/test_devargs.c | 101 ++++++++++++++++++++++------
app/test/test_kvargs.c | 16 +++++
lib/eal/common/eal_common_devargs.c | 4 ++
lib/kvargs/rte_kvargs.c | 6 +-
4 files changed, 106 insertions(+), 21 deletions(-)
--
2.53.0
next reply other threads:[~2026-10-05 16:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 16:53 Stephen Hemminger [this message]
2026-10-05 16:53 ` [PATCH 1/4] devargs: fix NULL args with global device syntax Stephen Hemminger
2026-10-05 16:53 ` [PATCH 2/4] kvargs: harden rte_kvargs_parse Stephen Hemminger
2026-10-05 16:53 ` [PATCH 3/4] test/devargs: use unit test suite runner Stephen Hemminger
2026-10-05 16:53 ` [PATCH 4/4] test/devargs: add tests for missing device arguments 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=20261005165512.334085-1-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@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