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 88A9C45BB6 for ; Wed, 23 Oct 2024 23:19:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 828B440261; Wed, 23 Oct 2024 23:19:47 +0200 (CEST) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by mails.dpdk.org (Postfix) with ESMTP id DBCCF40261 for ; Wed, 23 Oct 2024 23:19:45 +0200 (CEST) Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-431695fa98bso1988465e9.3 for ; Wed, 23 Oct 2024 14:19:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729718385; x=1730323185; 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=1DEAugYL6tySWLL7GwSt3ThQGWJJxjT3gR8MVVhvUug=; b=lygs5NFGX6MAJQK+luEnXsiCf8pckgBDf7BpYzam/NK9q7jE6Omi9r0GqXa10hL6Zo e+UTw8WYyTWbbzUkMP3k6gC3VgiTA+TT3F7EFGekgymzu89uF6x2lLxh40h1mcznl9OT yW40vZ727+CHIFENyzpzwxjd7Pylnt5bV1eZZYk/fHv3cSijaJOgk87EdYo/CMpQ0Mm8 oZz5VmPvEveu++0zRpc4yUixc6IMxZIDG2AfWrg+dd58dRHLxdoPsiCxLfGwwEN5ZYGF 3eWw/O+IkyfBUF7lzFHU5Ubo0fdt14UQ+J/15lvzMhtdAPvlJlZ+h5dN0LWi36dz3rHo pdRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729718385; x=1730323185; 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=1DEAugYL6tySWLL7GwSt3ThQGWJJxjT3gR8MVVhvUug=; b=k52n4MJ58K/IPyvku/HXlemsS1x7Z9DDm+Uwbxh6qCpo1RonYMGLVILf0e1jYS4tvG LKqFymjCf8oFuGsyS3Xav0wRqwVCzbv2JbkD8xuWPZ2Nq9kdDunM9gLzRUefIQASIbEE Vd5LfcFVcaVi6UWP+QW70sIGUirbEcYsbfXkY/JR7TlpTv0qTHlVDWlSgaCPucYjwV8N COGqqsH3gH4tsI/dlLYLvKbr0hVQ/dvM6iZ0WqdUxShnU6mOezDWUaPjvtWmX0KtBEZY mOzf9/tOHFUBLaggOz7FbzEoYWrCplX63nGPY+j75BXqumfGXnldiIj6t74zzboumMBl KEhA== X-Forwarded-Encrypted: i=1; AJvYcCWFD9lSX4ws0PygWq+4J8CdK2MCu6uY1ZbUcbDZGRlOPlwVka7XOP8g311Ewip4C296AbjoBMg=@dpdk.org X-Gm-Message-State: AOJu0YyqhCYY5cFV3u1i7gRgzC9J5GKxMNv3Zh/rOK4TGiLRSPLx4db6 7ZV8n8x0JrxbB/p4wKKyhBq1Epq4PQE26c1h+nLyuYg78Cifc3qX71XHr9uT X-Google-Smtp-Source: AGHT+IHao4tMootFBgEvv4dHAnKvpsKZIbROb+yG5x3c7WVR3hhdUus1Mat+Zzo2uEswlcDG5DfLXQ== X-Received: by 2002:adf:f201:0:b0:37d:4afe:8c9b with SMTP id ffacd0b85a97d-37efcf8cdc4mr2391863f8f.54.1729718385328; Wed, 23 Oct 2024 14:19:45 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:21cd:def0:a01d:d2aa]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37ee0b9bc90sm9714481f8f.100.2024.10.23.14.19.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 14:19:44 -0700 (PDT) From: luca.boccassi@gmail.com To: Barbara Skobiej Cc: Anatoly Burakov , Bruce Richardson , dpdk stable Subject: patch 'net/i40e/base: fix loop bounds' has been queued to stable release 22.11.7 Date: Wed, 23 Oct 2024 22:16:24 +0100 Message-ID: <20241023211704.1216956-44-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241023211704.1216956-1-luca.boccassi@gmail.com> References: <20241023211704.1216956-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 10/25/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/6c69f14358ba4ae6412cbf2c5eb73dfe9ccfa09b Thanks. Luca Boccassi --- >From 6c69f14358ba4ae6412cbf2c5eb73dfe9ccfa09b Mon Sep 17 00:00:00 2001 From: Barbara Skobiej Date: Mon, 2 Sep 2024 10:54:35 +0100 Subject: [PATCH] net/i40e/base: fix loop bounds [ upstream commit 3e61fe48412f46daa66f7ccc8f03b1e7620d0b64 ] An unchecked value used as a loop bound. Add verification if value of 'next_to_clean' variable is greater than 2^10 (next_to_clean is 10 bits). Also, refactored loop so that it reads the head value only once, and also checks if head is invalid. Fixes: 8db9e2a1b232 ("i40e: base driver") Signed-off-by: Barbara Skobiej Signed-off-by: Anatoly Burakov Acked-by: Bruce Richardson --- drivers/net/i40e/base/i40e_adminq.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c index 27c82d9b44..cd3b0f2e45 100644 --- a/drivers/net/i40e/base/i40e_adminq.c +++ b/drivers/net/i40e/base/i40e_adminq.c @@ -791,12 +791,26 @@ u16 i40e_clean_asq(struct i40e_hw *hw) u16 ntc = asq->next_to_clean; struct i40e_aq_desc desc_cb; struct i40e_aq_desc *desc; + u32 head = 0; + + if (ntc >= (1 << 10)) + goto clean_asq_exit; desc = I40E_ADMINQ_DESC(*asq, ntc); details = I40E_ADMINQ_DETAILS(*asq, ntc); - while (rd32(hw, hw->aq.asq.head) != ntc) { + while (true) { + head = rd32(hw, hw->aq.asq.head); + + if (head >= asq->count) { + i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "Read head value is improper\n"); + return 0; + } + + if (head == ntc) + break; + i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, - "ntc %d head %d.\n", ntc, rd32(hw, hw->aq.asq.head)); + "ntc %d head %d.\n", ntc, head); if (details->callback) { I40E_ADMINQ_CALLBACK cb_func = @@ -816,6 +830,7 @@ u16 i40e_clean_asq(struct i40e_hw *hw) asq->next_to_clean = ntc; +clean_asq_exit: return I40E_DESC_UNUSED(asq); } -- 2.45.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-10-23 22:16:42.189323744 +0100 +++ 0044-net-i40e-base-fix-loop-bounds.patch 2024-10-23 22:16:40.495942585 +0100 @@ -1 +1 @@ -From 3e61fe48412f46daa66f7ccc8f03b1e7620d0b64 Mon Sep 17 00:00:00 2001 +From 6c69f14358ba4ae6412cbf2c5eb73dfe9ccfa09b Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 3e61fe48412f46daa66f7ccc8f03b1e7620d0b64 ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org @@ -23 +24 @@ -index b670250180..350288269b 100644 +index 27c82d9b44..cd3b0f2e45 100644 @@ -26 +27 @@ -@@ -745,12 +745,26 @@ u16 i40e_clean_asq(struct i40e_hw *hw) +@@ -791,12 +791,26 @@ u16 i40e_clean_asq(struct i40e_hw *hw) @@ -55 +56 @@ -@@ -770,6 +784,7 @@ u16 i40e_clean_asq(struct i40e_hw *hw) +@@ -816,6 +830,7 @@ u16 i40e_clean_asq(struct i40e_hw *hw)