DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chengwen Feng <fengchengwen@huawei.com>
To: <thomas@monjalon.net>, <ferruh.yigit@amd.com>,
	<stephen@networkplumber.org>, Zyta Szpak <zr@semihalf.com>,
	Liron Himi <lironh@marvell.com>,
	Dmitri Epshtein <dima@marvell.com>,
	Natalie Samsonov <nsamsono@marvell.com>,
	Andrzej Ostruszka <amo@semihalf.com>,
	Ferruh Yigit <ferruh.yigit@intel.com>
Cc: <dev@dpdk.org>
Subject: [PATCH] net/mvneta: fix possible out-of-bounds write
Date: Wed, 9 Oct 2024 02:23:42 +0000	[thread overview]
Message-ID: <20241009022342.39152-1-fengchengwen@huawei.com> (raw)

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>
---
 drivers/net/mvneta/mvneta_ethdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c
index 3841c1ebe9..c49f083efa 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -91,6 +91,9 @@ mvneta_ifnames_get(const char *key __rte_unused, const char *value,
 {
 	struct mvneta_ifnames *ifnames = extra_args;
 
+	if (ifnames->idx >= NETA_NUM_ETH_PPIO)
+		return -EINVAL;
+
 	ifnames->names[ifnames->idx++] = value;
 
 	return 0;
-- 
2.17.1


             reply	other threads:[~2024-10-09  2:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-09  2:23 Chengwen Feng [this message]
2024-10-09  3:48 ` Stephen Hemminger
2024-10-09  3:48 ` zhoumin
2024-10-09  6:08 ` [PATCH v2] " Chengwen Feng
2024-10-09 15:09   ` 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

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=20241009022342.39152-1-fengchengwen@huawei.com \
    --to=fengchengwen@huawei.com \
    --cc=amo@semihalf.com \
    --cc=dev@dpdk.org \
    --cc=dima@marvell.com \
    --cc=ferruh.yigit@amd.com \
    --cc=ferruh.yigit@intel.com \
    --cc=lironh@marvell.com \
    --cc=nsamsono@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).