From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A099245AE6; Wed, 9 Oct 2024 05:48:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6F3434065F; Wed, 9 Oct 2024 05:48:04 +0200 (CEST) Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by mails.dpdk.org (Postfix) with ESMTP id 3030F4028A for ; Wed, 9 Oct 2024 05:48:03 +0200 (CEST) Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-71de9e1f374so3344930b3a.1 for ; Tue, 08 Oct 2024 20:48:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1728445682; x=1729050482; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=PFYbgLNcuKHBHhNQrCiUPzxHcq7ko1H8KjHf+kxRr3g=; b=LTqbQT1Xbzl+pdIKDY7yx39nOFhe/yJSvIoqMyPR5VnuQ+WhpvkFodwtVPkHZm3dxS E8Sx82h/3b2FL73c0cihOaU8iCm8G5wBKGLtQyqfhlN0iyD4Ixmc8TEgswOk7UfoKZdq UtoH8PIgIAzdLjuk4ddCjlesd3nZKeq8HhVz7HylaTBMU2QMj7Ey9B/tqG1o1lzPKoq9 t9QT3RZjWIGdU8mN7029lPvSsSO93WC3XVQy5ccyh2ZEBsFXtGL9gPaoKAZYo39sAEbe uJNphx61SvSvCGl2FknaephBpd+OEIvMkg9KldiA2DTUtCohjvkhshEM4mLlKNCol3eV za4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728445682; x=1729050482; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PFYbgLNcuKHBHhNQrCiUPzxHcq7ko1H8KjHf+kxRr3g=; b=X8wlkpDNMlJ2SOubx5iacFV0oyqpwZ9ZHVBij7sMhjDwpLpONatrLTyDCgQviXv3xj J8dQtB63SowdIW/hh0IiQAXZ0p77RH6iAL6Kvrqm8DA+cRqQ6eYQ4P6YxKw3bagVqzx/ H3e345paqSG1nLcrDXeoiBwnNl/bef0oj+TWFtKK/tPEQjD9G0t2JP+pHiPqZFtHiKLh 1wJe62PCj37mqno1q5paAWQ13l6r+QuHSiycJDR6NYEL/jPiy23WaGXKLCqr1w9XjsIg 5h6H8in5kFyOWqiUxnsenMz2oufFmjOXzDCtwsbbd2AsYQyMraz0LO2+xTo2zgCDRxc1 pVcQ== X-Forwarded-Encrypted: i=1; AJvYcCUHPsb23C2NEoJ7MsrrXX9/mhuc6gUBxNVRmlfd7xgTX+ZNawoGHN1583dGJGEqO/TvYlw=@dpdk.org X-Gm-Message-State: AOJu0Yx4H2m/XBcufcelcstfWaj53NqXIqPdpMrSFCENd8mPxzm0VA8+ RLjYGXD4v3prO6YNLlFKRJn6P05ahKgbOk3U9+1OQR+FVvD0wc5XVT3uZE3TLzI= X-Google-Smtp-Source: AGHT+IHIjArkWQpnMPKFn3JS3kJFD2mw4Bwj4yVsQfP6z2bqFWqcftf6IhXy9PQMN2kFNMQ47Esukg== X-Received: by 2002:a05:6a00:1903:b0:71e:a82:fad4 with SMTP id d2e1a72fcca58-71e1db64798mr1541341b3a.1.1728445682137; Tue, 08 Oct 2024 20:48:02 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0cbcebcsm6854880b3a.22.2024.10.08.20.48.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 20:48:01 -0700 (PDT) Date: Tue, 8 Oct 2024 20:48:00 -0700 From: Stephen Hemminger To: Chengwen Feng Cc: , , Zyta Szpak , Liron Himi , Dmitri Epshtein , Natalie Samsonov , Andrzej Ostruszka , Ferruh Yigit , Subject: Re: [PATCH] net/mvneta: fix possible out-of-bounds write Message-ID: <20241008204800.4555e463@hermes.local> In-Reply-To: <20241009022342.39152-1-fengchengwen@huawei.com> References: <20241009022342.39152-1-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Wed, 9 Oct 2024 02:23:42 +0000 Chengwen Feng 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 > Acked-by: Ferruh Yigit > --- > 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.