From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id AA79443387;
	Tue, 21 Nov 2023 03:11:30 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 98502402C4;
	Tue, 21 Nov 2023 03:11:30 +0100 (CET)
Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188])
 by mails.dpdk.org (Postfix) with ESMTP id EE7D54025F
 for <dev@dpdk.org>; Tue, 21 Nov 2023 03:11:28 +0100 (CET)
Received: from kwepemm000004.china.huawei.com (unknown [172.30.72.56])
 by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SZ7C06CzGzWhb1;
 Tue, 21 Nov 2023 10:10:52 +0800 (CST)
Received: from [10.67.121.59] (10.67.121.59) by kwepemm000004.china.huawei.com
 (7.193.23.18) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 21 Nov
 2023 10:11:23 +0800
Message-ID: <12db24c9-5015-f832-c1a6-358adfd6e401@huawei.com>
Date: Tue, 21 Nov 2023 10:11:23 +0800
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
 Thunderbird/91.2.0
Subject: Re: [PATCH v5 5/5] net/mvneta: fix possible out-of-bounds write
To: Chengwen Feng <fengchengwen@huawei.com>, <thomas@monjalon.net>,
 <ferruh.yigit@amd.com>, Zyta Szpak <zr@semihalf.com>, Liron Himi
 <lironh@marvell.com>, Ferruh Yigit <ferruh.yigit@intel.com>, Yelena
 Krivosheev <yelena@marvell.com>, Dmitri Epshtein <dima@marvell.com>, Andrzej
 Ostruszka <amo@semihalf.com>
CC: <dev@dpdk.org>, <stephen@networkplumber.org>
References: <20230314124813.39521-1-fengchengwen@huawei.com>
 <20231106073125.55280-1-fengchengwen@huawei.com>
 <20231106073125.55280-6-fengchengwen@huawei.com>
From: "lihuisong (C)" <lihuisong@huawei.com>
In-Reply-To: <20231106073125.55280-6-fengchengwen@huawei.com>
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: 8bit
X-Originating-IP: [10.67.121.59]
X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To
 kwepemm000004.china.huawei.com (7.193.23.18)
X-CFilter-Loop: Reflected
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Acked-by: Huisong Li <lihuisong@huawei.com>

在 2023/11/6 15:31, Chengwen Feng 写道:
> 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 daa69e533a..8032a712f4 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;