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 C67D545CD8; Mon, 18 Nov 2024 19:22:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E32B842831; Mon, 18 Nov 2024 19:22:12 +0100 (CET) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by mails.dpdk.org (Postfix) with ESMTP id 56FEC427AD for ; Mon, 18 Nov 2024 19:22:08 +0100 (CET) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-20c805a0753so164215ad.0 for ; Mon, 18 Nov 2024 10:22:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731954127; x=1732558927; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uUuh8YUBHlS+h1FpglCbyQEOVWWPo9BM+tBZMeNdbPU=; b=c7GV9qrfvKqsAT+ehO/KNx31ZFz4RF8FZPDqbAi8IHhqMdsitIUI8dXRwQNvSeVoaF s6P5IHa/UUEwaPiRFjX9O+f6dOwLsKSZhn3CvdADPAvdepSA3yFXiG7EYp2SW9SPI7DM f1isqsxQdeFsKGjtvst5Xv53GI15m8Ro3MmdTLZoFf+wBEdhI2usZXQdbJHnXG3DiOsR DJ6uy4BmMKpIqgXZ1qtOXt6Kx5xWCRrJLWUjik/1p5vB8oGDu4mY9g+CBHL36Xe03mYc t4btUVi6Y/yU4tXj9+xf/DfHlNUkdWLPTT1A4fS+9rMncfVA1jDbDKESmV4utcQ+9DlF Um5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731954127; x=1732558927; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uUuh8YUBHlS+h1FpglCbyQEOVWWPo9BM+tBZMeNdbPU=; b=NFgjwKXV0TorDWEiVFaMsN2IV5d0nGv92HbE41HKGN1KnctpOGPFaXwzjEPYHhrGEb DC3SWZjPQIWvnM1Vwf+HCbH/doQwB428Y7asVJax95FlpqBgNjvdJBosAL2MugvJn3k5 r2rHzdbtQS+ECEz1Ogy9gLKcFazjBZlkUYYiXb91YZeEnG04bCuycPOQ49JHAszbHklC vFnZeLPROurOD+uoELxp399OGNBi4aQ+RIEHjXEyDaf7Xp1RS9EBl3mJbfi41bK60iWV fJuBNaE1Se4zh6BqT5pwCW2+OVyox24eKsecPjP43uyq2BVkArq5PAK97w339QRRG4N1 ZU6w== X-Gm-Message-State: AOJu0Yy/gJAkSgvC1FPv+vyj/8cnbaDbxbhhg3yl5B1Lb5yYz1G0bXhN EZfp7mBsywOObzJcG1Kv0xs55nVcHwnLJredwbscyu3Ke8cRIymX6tgdAl8R02LspcjDzc5qCAA X X-Google-Smtp-Source: AGHT+IGoNKOwcB2IsvQGgWUpsOeKa1Mm9YmmraE9zKA5hvIx2FHfiBVPkMvNpDmpkFIAvbQGzRz6UA== X-Received: by 2002:a17:902:da8b:b0:20c:d2d9:766f with SMTP id d9443c01a7336-211d0d724bdmr177957305ad.14.1731954127577; Mon, 18 Nov 2024 10:22:07 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ea61869bb2sm2916724a91.12.2024.11.18.10.22.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 10:22:07 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , xuemingl@nvidia.com, stable@dpdk.org Subject: [PATCH v2 06/19] eal: fix out of bounds access in devargs Date: Mon, 18 Nov 2024 10:20:47 -0800 Message-ID: <20241118182153.87042-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118182153.87042-1-stephen@networkplumber.org> References: <20241115060738.313190-1-stephen@networkplumber.org> <20241118182153.87042-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 The code for parsing layers in devargs could reference past the end of layers[] array on stack. Link: https://pvs-studio.com/en/blog/posts/cpp/1183/ Fixes: 9a1a9e4a2ddd ("devargs: support path value with global device syntax") Cc: xuemingl@nvidia.com Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger --- lib/eal/common/eal_common_devargs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c index a64805b268..dd857fc839 100644 --- a/lib/eal/common/eal_common_devargs.c +++ b/lib/eal/common/eal_common_devargs.c @@ -88,7 +88,7 @@ rte_devargs_layers_parse(struct rte_devargs *devargs, s = devargs->data; while (s != NULL) { - if (nblayer > RTE_DIM(layers)) { + if (nblayer >= RTE_DIM(layers)) { ret = -E2BIG; goto get_out; } -- 2.45.2