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 0B59D45DB9 for ; Wed, 27 Nov 2024 18:21:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 05A6B4066C; Wed, 27 Nov 2024 18:21:43 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id A8EF740A6F for ; Wed, 27 Nov 2024 18:21:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732728101; 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=8U5FyNfuZWso4rsxJ7tWZQya6xDg/v2ckhySEELPwhU=; b=EJO9+o37pjbz3dlAipG7ebDZVH+snvzhC5kgo41iDUpOxFjM4H9MqKJLI0P7jBYabeyFfT G5+isLFyPJCQYwlNBy5Ci8S+qzJKLScAJU3IvdZ7GTQCvr6MF+YHGeh8HUblADOOEcxvp5 nmWdlWPO+Mk0Gm/WPDKv0dauC4bElaM= Received: from mx-prod-mc-03.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-692-tagFWcgENTiCHsEvOynfHA-1; Wed, 27 Nov 2024 12:21:38 -0500 X-MC-Unique: tagFWcgENTiCHsEvOynfHA-1 X-Mimecast-MFC-AGG-ID: tagFWcgENTiCHsEvOynfHA 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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D1EE61955F10; Wed, 27 Nov 2024 17:21:36 +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 3147330001A2; Wed, 27 Nov 2024 17:21:34 +0000 (UTC) From: Kevin Traynor To: Fabio Pricoco Cc: Bruce Richardson , Vladimir Medvedkin , dpdk stable Subject: patch 'net/ice/base: add bounds check' has been queued to stable release 21.11.9 Date: Wed, 27 Nov 2024 17:18:06 +0000 Message-ID: <20241127171916.690404-59-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: NPnHcaWuKhMjuobPn5yimcRWwcXlYWCyub1sqvcJ-qE_1732728097 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/42985910c50f05f0e47c50fe84cfe3d2ff43a32e Thanks. Kevin --- >From 42985910c50f05f0e47c50fe84cfe3d2ff43a32e Mon Sep 17 00:00:00 2001 From: Fabio Pricoco Date: Mon, 14 Oct 2024 12:02:06 +0100 Subject: [PATCH] net/ice/base: add bounds check [ upstream commit 9378aa47f45fa5cd5be219c8eb770f096e8a4c27 ] Refactor while loop to add a check that the values read are in the correct range. Fixes: 6c1f26be50a2 ("net/ice/base: add control queue information") Signed-off-by: Fabio Pricoco Signed-off-by: Bruce Richardson Acked-by: Vladimir Medvedkin --- drivers/net/ice/base/ice_controlq.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/net/ice/base/ice_controlq.c b/drivers/net/ice/base/ice_controlq.c index cdd067ce7f..541f05eb41 100644 --- a/drivers/net/ice/base/ice_controlq.c +++ b/drivers/net/ice/base/ice_controlq.c @@ -838,10 +838,21 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) struct ice_sq_cd *details; struct ice_aq_desc *desc; + u32 head; desc = ICE_CTL_Q_DESC(*sq, ntc); details = ICE_CTL_Q_DETAILS(*sq, ntc); - while (rd32(hw, cq->sq.head) != ntc) { - ice_debug(hw, ICE_DBG_AQ_MSG, "ntc %d head %d.\n", ntc, rd32(hw, cq->sq.head)); + head = rd32(hw, sq->head); + if (head >= sq->count) { + ice_debug(hw, ICE_DBG_AQ_MSG, + "Read head value (%d) exceeds allowed range.\n", + head); + return 0; + } + + while (head != ntc) { + ice_debug(hw, ICE_DBG_AQ_MSG, + "ntc %d head %d.\n", + ntc, head); ice_memset(desc, 0, sizeof(*desc), ICE_DMA_MEM); ice_memset(details, 0, sizeof(*details), ICE_NONDMA_MEM); @@ -851,4 +862,12 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) desc = ICE_CTL_Q_DESC(*sq, ntc); details = ICE_CTL_Q_DETAILS(*sq, ntc); + + head = rd32(hw, sq->head); + if (head >= sq->count) { + ice_debug(hw, ICE_DBG_AQ_MSG, + "Read head value (%d) exceeds allowed range.\n", + head); + return 0; + } } -- 2.47.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-11-27 17:17:40.116768082 +0000 +++ 0059-net-ice-base-add-bounds-check.patch 2024-11-27 17:17:38.234269420 +0000 @@ -1 +1 @@ -From 9378aa47f45fa5cd5be219c8eb770f096e8a4c27 Mon Sep 17 00:00:00 2001 +From 42985910c50f05f0e47c50fe84cfe3d2ff43a32e Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 9378aa47f45fa5cd5be219c8eb770f096e8a4c27 ] + @@ -10 +11,0 @@ -Cc: stable@dpdk.org @@ -20 +21 @@ -index af27dc8542..b210495827 100644 +index cdd067ce7f..541f05eb41 100644 @@ -23,2 +24,2 @@ -@@ -840,9 +840,20 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) - u16 ntc = sq->next_to_clean; +@@ -838,10 +838,21 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) + struct ice_sq_cd *details; @@ -28,0 +30 @@ + details = ICE_CTL_Q_DETAILS(*sq, ntc); @@ -45,3 +47,2 @@ - ntc++; -@@ -850,4 +861,12 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) - ntc = 0; + ice_memset(details, 0, sizeof(*details), ICE_NONDMA_MEM); +@@ -851,4 +862,12 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) @@ -48,0 +50 @@ + details = ICE_CTL_Q_DETAILS(*sq, ntc);