[PATCH] net/mvneta: fix possible out-of-bounds write
Stephen Hemminger
stephen at networkplumber.org
Wed Oct 9 05:48:00 CEST 2024
On Wed, 9 Oct 2024 02:23:42 +0000
Chengwen Feng <fengchengwen at 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 at dpdk.org
>
> Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
> Acked-by: Ferruh Yigit <ferruh.yigit at 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.
More information about the dev
mailing list