From: Chengwen Feng <fengchengwen@huawei.com>
To: <thomas@monjalon.net>, <ferruh.yigit@amd.com>,
<stephen@networkplumber.org>
Cc: <dev@dpdk.org>, <zr@semihalf.com>, <lironh@marvell.com>
Subject: [PATCH v2] net/mvneta: fix possible out-of-bounds write
Date: Wed, 9 Oct 2024 06:08:45 +0000 [thread overview]
Message-ID: <20241009060845.2702-1-fengchengwen@huawei.com> (raw)
In-Reply-To: <20241009022342.39152-1-fengchengwen@huawei.com>
The mvneta_ifnames_get() function will save 'iface' value to ifnames,
it will out-of-bounds write if passed many iface pairs (e.g.
'iface=xxx,iface=xxx,...').
Fixes: 4ccc8d770d3b ("net/mvneta: add PMD skeleton")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
---
v2: add error log which address Stephen's comment.
---
drivers/net/mvneta/mvneta_ethdev.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c
index 3841c1ebe9..e641f19266 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -91,6 +91,11 @@ mvneta_ifnames_get(const char *key __rte_unused, const char *value,
{
struct mvneta_ifnames *ifnames = extra_args;
+ if (ifnames->idx >= NETA_NUM_ETH_PPIO) {
+ MVNETA_LOG(ERROR, "Detect too many ifnames!");
+ return -EINVAL;
+ }
+
ifnames->names[ifnames->idx++] = value;
return 0;
--
2.17.1
next prev parent reply other threads:[~2024-10-09 6:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 2:23 [PATCH] " Chengwen Feng
2024-10-09 3:48 ` Stephen Hemminger
2024-10-09 3:48 ` zhoumin
2024-10-09 6:08 ` Chengwen Feng [this message]
2024-10-09 15:09 ` [PATCH v2] " Stephen Hemminger
2024-10-09 18:00 ` Stephen Hemminger
2024-10-10 1:01 ` fengchengwen
2024-10-10 0:53 ` [PATCH v3] " Chengwen Feng
2024-10-10 1:10 ` Stephen Hemminger
2024-10-24 6:27 ` Jerin Jacob
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=20241009060845.2702-1-fengchengwen@huawei.com \
--to=fengchengwen@huawei.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=lironh@marvell.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
--cc=zr@semihalf.com \
/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).