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 0C6AD45DB9 for ; Wed, 27 Nov 2024 18:21:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A2525402DE; Wed, 27 Nov 2024 18:21:00 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 2B1B5402DE for ; Wed, 27 Nov 2024 18:20:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732728058; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9tpyOMDy133TIKPznyu/+jAr9S1k9x0bcaXzEEuyGvc=; b=YfGwY/EC5PUPCqWUxGFAspKZiF4WymSpmcQgF1eE+5EaXlFcf7LanEuQ3/MwHzj/DjiZUo Txw1+MXPAFnH5da11P23GZl7h+v4K4Zsr2uBDvQIWRYFhJdVXF0cJ29i0uyZW7hCYQpTOa Y5bsqToASLn+ZSSqI3xOku4x5RoQB70= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-651-lq-1FLM6P2WdtNaGO14FIQ-1; Wed, 27 Nov 2024 12:20:53 -0500 X-MC-Unique: lq-1FLM6P2WdtNaGO14FIQ-1 X-Mimecast-MFC-AGG-ID: lq-1FLM6P2WdtNaGO14FIQ Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 62A5719560B5; Wed, 27 Nov 2024 17:20:52 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.192.52]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A0F7D3003B71; Wed, 27 Nov 2024 17:20:50 +0000 (UTC) From: Kevin Traynor To: Barbara Skobiej Cc: Anatoly Burakov , Bruce Richardson , dpdk stable Subject: patch 'net/i40e/base: fix loop bounds' has been queued to stable release 21.11.9 Date: Wed, 27 Nov 2024 17:17:45 +0000 Message-ID: <20241127171916.690404-38-ktraynor@redhat.com> In-Reply-To: <20241127171916.690404-1-ktraynor@redhat.com> References: <20241127171916.690404-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: NGepzjBgj6ZhrTgZamIC1mZRg-beWD0gk6MTSKZnB2k_1732728052 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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 21.11.9 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/02/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/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/1a38fc74c173a730b557cd4bad8691f3387573db Thanks. Kevin --- >From 1a38fc74c173a730b557cd4bad8691f3387573db 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 @@ -792,10 +792,24 @@ u16 i40e_clean_asq(struct i40e_hw *hw) 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) { @@ -817,4 +831,5 @@ u16 i40e_clean_asq(struct i40e_hw *hw) asq->next_to_clean = ntc; +clean_asq_exit: return I40E_DESC_UNUSED(asq); } -- 2.47.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-11-27 17:17:39.490647542 +0000 +++ 0038-net-i40e-base-fix-loop-bounds.patch 2024-11-27 17:17:38.204269264 +0000 @@ -1 +1 @@ -From 3e61fe48412f46daa66f7ccc8f03b1e7620d0b64 Mon Sep 17 00:00:00 2001 +From 1a38fc74c173a730b557cd4bad8691f3387573db 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 @@ -@@ -746,10 +746,24 @@ u16 i40e_clean_asq(struct i40e_hw *hw) +@@ -792,10 +792,24 @@ u16 i40e_clean_asq(struct i40e_hw *hw) @@ -53 +54 @@ -@@ -771,4 +785,5 @@ u16 i40e_clean_asq(struct i40e_hw *hw) +@@ -817,4 +831,5 @@ u16 i40e_clean_asq(struct i40e_hw *hw)