DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Chengwen Feng <fengchengwen@huawei.com>
Cc: <thomas@monjalon.net>, <ferruh.yigit@amd.com>,
	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>, <dev@dpdk.org>
Subject: Re: [PATCH] net/mvneta: fix possible out-of-bounds write
Date: Tue, 8 Oct 2024 20:48:00 -0700	[thread overview]
Message-ID: <20241008204800.4555e463@hermes.local> (raw)
In-Reply-To: <20241009022342.39152-1-fengchengwen@huawei.com>

On Wed, 9 Oct 2024 02:23:42 +0000
Chengwen Feng <fengchengwen@huawei.com> wrote:

> 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;
> +

Looks like a reasonable fix but for if some user tried to set up too many
devices, best to add a log message with severity of ERR to help them know why.

  reply	other threads:[~2024-10-09  3:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-09  2:23 Chengwen Feng
2024-10-09  3:48 ` Stephen Hemminger [this message]
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=20241008204800.4555e463@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=amo@semihalf.com \
    --cc=dev@dpdk.org \
    --cc=dima@marvell.com \
    --cc=fengchengwen@huawei.com \
    --cc=ferruh.yigit@amd.com \
    --cc=ferruh.yigit@intel.com \
    --cc=lironh@marvell.com \
    --cc=nsamsono@marvell.com \
    --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).