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 6AB5645AF5; Wed, 9 Oct 2024 20:00:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4EB8940647; Wed, 9 Oct 2024 20:00:44 +0200 (CEST) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by mails.dpdk.org (Postfix) with ESMTP id 3498D402E0 for ; Wed, 9 Oct 2024 20:00:43 +0200 (CEST) Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-20c7edf2872so1958825ad.1 for ; Wed, 09 Oct 2024 11:00:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1728496842; x=1729101642; 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=EJltY32Y0+NRdBKagtURlR5kxeDAJx+b7GjXWQUrrAg=; b=bDo678elehQUb8kDVMDhLXulojKsKy+sM67Kzop74EA3+gCEQH4tfOqDKjgzngAbgW 0UMvuq5IKNQ/dCajRIfPSXd19P6qbRrTDEpDynedFI2dJv7QwJmrK6zdmqCtGUZ46ZjM pcZZnHTNXT3lI5nG8wnN2Glzz/gSofyJCkL/fhe8r8uvNS986axjJ7tNKAJr5P9O05eJ n75A0GMyhN3cK77tGomAQqv4LVLC05NDuJxVWlwsrGcDoyxpmE+whvI7VAjz6ZYUPfUy gdbd4hbeOfXxPyv+U3Me9TSkYjQzvTbWZkQBWgvWpy2Z5rGjGd0pBiy3+VfIwkHWe50+ deJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728496842; x=1729101642; 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=EJltY32Y0+NRdBKagtURlR5kxeDAJx+b7GjXWQUrrAg=; b=YI7tXWHZyFySGnLoKzUeFbH8aUnfbA2vOIGOVCGKPRO+LOklfnRMB4pE6ri5DR5uFo /VBuslXy5RFW28a7pHDgl3Aoy6YET1OBBp590Vpf6SwY1y0IfhJ8IVgqp2mgF730/gdK EM/XKGSib0VbBqxzYWSllDTpLOqqV1HUBBro5K/RB72QXlxcyKc2kW7r0m54NyQrcehE MqmP+Bf+9qFZkMp9ZnW7+ijx7iUgcbjk8szgE+0nvq7o0XSR6e0EYrYtX+GiYd9016dO Q1v9+UX42PGz+BtLJHkhBptJmoaQyhMGV/PQzVjHs+xmz4hXZXWPI10J/Gx7yqFEIBzs QR8w== X-Forwarded-Encrypted: i=1; AJvYcCUx7JCO08LbxSN3XpGFXbG3/MK546hp3YrRuBSr0W5f41irAJiC0rHh+aYukSuZlI+G3Zo=@dpdk.org X-Gm-Message-State: AOJu0Yygfg8ApC2twHWejKAQSOxmPqfa55o5ikwNE+qlMT5sFYkfbsKi pgrl6ovjlx56bdhm0HRk3KSJ2pgGfYlkxeN86yaDJ0sRabjcWmQl3J1aw4UgiAI= X-Google-Smtp-Source: AGHT+IHO7UwMCubxIQ80UgKIiwV/QzD5fjZFXrv526RRAqHpthBzWhydm1P0nlG4y9u5rad5WF91Ng== X-Received: by 2002:a17:902:e806:b0:20c:6bff:fcb1 with SMTP id d9443c01a7336-20c8047c17dmr8066055ad.1.1728496842322; Wed, 09 Oct 2024 11:00:42 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13971c85sm73757985ad.239.2024.10.09.11.00.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 11:00:42 -0700 (PDT) Date: Wed, 9 Oct 2024 11:00:40 -0700 From: Stephen Hemminger To: Chengwen Feng Cc: , , , , Subject: Re: [PATCH v2] net/mvneta: fix possible out-of-bounds write Message-ID: <20241009110040.11386e4f@hermes.local> In-Reply-To: <20241009060845.2702-1-fengchengwen@huawei.com> References: <20241009022342.39152-1-fengchengwen@huawei.com> <20241009060845.2702-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 06:08:45 +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 > > --- > v2: add error log which address Stephen's comment. > > --- > drivers/net/mvneta/mvneta_ethdev.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c > index 3841c1ebe9..e641f19266 100644 > --- a/drivers/net/mvneta/mvneta_ethdev.c > +++ b/drivers/net/mvneta/mvneta_ethdev.c > @@ -91,6 +91,11 @@ mvneta_ifnames_get(const char *key __rte_unused, const char *value, > { > struct mvneta_ifnames *ifnames = extra_args; > > + if (ifnames->idx >= NETA_NUM_ETH_PPIO) { > + MVNETA_LOG(ERROR, "Detect too many ifnames!"); > + return -EINVAL; > + } > + Compile fails due to typo. Need to use "ERR," not "ERROR,"