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 0AFDE45BB6 for ; Wed, 23 Oct 2024 23:21:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 05FFB43324; Wed, 23 Oct 2024 23:21:18 +0200 (CEST) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by mails.dpdk.org (Postfix) with ESMTP id 066AF43324 for ; Wed, 23 Oct 2024 23:21:17 +0200 (CEST) Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4316f3d3c21so1992105e9.3 for ; Wed, 23 Oct 2024 14:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729718476; x=1730323276; 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=0I/KlrgAj8EApKKkS/OJZw8CgAHCSst/9PyxiYQBhsc=; b=W8JIm7ftLbNSzkToTSo4YahWOV8d5IoPTSq0FXq8zq/bZvor6IQ7XzjvfL9zVQ331W vrtmyiVqfcmZ8eB/pNZivG17kteQlvmoa0TwAAaWwodJGsaOuPBejRHqkRsdok+qM5Gz 74ioO/F3PvKmumrcWEXgvfprbQ2/wmfwbrZE7V/aT+V70J74ongXCgSSwwqqyraohoC+ JgP3QGAE4enbCd90sB1tdIot3c6l6Fv7s0aQmzi0X3Sdu4RslY4HXy09XF/d1G6IMlJ5 A3G6uznad+KfQZ6G6XR74MFMtqPm9pttvU9k614+GGzB3YXze5BwMYJLq/3sl827FsjN ZShA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729718476; x=1730323276; 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=0I/KlrgAj8EApKKkS/OJZw8CgAHCSst/9PyxiYQBhsc=; b=MoUGFkEAptktPMMWARn/fQm7ZVLlXXyaFWE4GYP3RsE0lm4jFyZOFIiQ8my5HSLylU lbKHg2yE/0JS118rkJVDeUcG1SK8QmUZfyWmHZMJCKcsNPs5+GjXmyjfAJz8fKxjSZuS DgnmobmYFpwz/uXrbPuapO5iIwxGeljvFm/hjNWvcGhtKQGfgYs+wmj5Fw5KwoE9EbFS mq7OQLKJwBnY45WCrYJg+nMeRTyZl4lrAUZLz8+Iz3Ckuw4VyJftxjnVYHUs6zKVTt/H gAUBHXl8+VnquwmVW3ngXpW7Rcb5VIw2/jDonpEs/PgiF2TkdySFoJISMh2vqMuj1Nr+ ynjw== X-Forwarded-Encrypted: i=1; AJvYcCWZ5nl084mEv7zv3CruspYdKEMVbj1Nhts6CeIjk3C1RtbOwAfYTGbV7BattrgsW83xWLglUsQ=@dpdk.org X-Gm-Message-State: AOJu0Yw76GoJiwois2El75oZ+Yq07RX+f7Sayf8xdc2Q7QcUC6yCyyH1 GzD3VuTPXE+KN2SVZgrDVGNJnPbkUjtuXo2HTrxyEtBff9TUQzGLnFz89hn4 X-Google-Smtp-Source: AGHT+IFFncH5hQZruPg7SJNCqjV9fFtdYymK4j6YlBo1eCmkFQy4GBtqA2GhvaSyTfHvavpf3TrtVw== X-Received: by 2002:a05:600c:4f0b:b0:431:5f1c:8352 with SMTP id 5b1f17b1804b1-431841300e3mr33784085e9.5.1729718476439; Wed, 23 Oct 2024 14:21:16 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:21cd:def0:a01d:d2aa]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186bdb84bsm27000175e9.12.2024.10.23.14.21.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 14:21:16 -0700 (PDT) From: luca.boccassi@gmail.com To: Fabio Pricoco Cc: Bruce Richardson , Vladimir Medvedkin , dpdk stable Subject: patch 'net/ice/base: add bounds check' has been queued to stable release 22.11.7 Date: Wed, 23 Oct 2024 22:16:47 +0100 Message-ID: <20241023211704.1216956-67-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/19bb1781fec55402dd06a046ec5aa88add31ee13 Thanks. Luca Boccassi --- >From 19bb1781fec55402dd06a046ec5aa88add31ee13 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 8971a140ef..576bf8e38d 100644 --- a/drivers/net/ice/base/ice_controlq.c +++ b/drivers/net/ice/base/ice_controlq.c @@ -846,12 +846,23 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) u16 ntc = sq->next_to_clean; 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); ntc++; @@ -859,6 +870,14 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) ntc = 0; 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; + } } sq->next_to_clean = ntc; -- 2.45.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-10-23 22:16:43.057419025 +0100 +++ 0067-net-ice-base-add-bounds-check.patch 2024-10-23 22:16:40.527943830 +0100 @@ -1 +1 @@ -From 9378aa47f45fa5cd5be219c8eb770f096e8a4c27 Mon Sep 17 00:00:00 2001 +From 19bb1781fec55402dd06a046ec5aa88add31ee13 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 8971a140ef..576bf8e38d 100644 @@ -23,2 +24 @@ -@@ -839,16 +839,35 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) - struct ice_ctl_q_ring *sq = &cq->sq; +@@ -846,12 +846,23 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) @@ -25,0 +26 @@ + struct ice_sq_cd *details; @@ -29,0 +31 @@ + details = ICE_CTL_Q_DETAILS(*sq, ntc); @@ -45,0 +48 @@ + ice_memset(details, 0, sizeof(*details), ICE_NONDMA_MEM); @@ -47 +50 @@ - if (ntc == sq->count) +@@ -859,6 +870,14 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) @@ -49,0 +53 @@ + details = ICE_CTL_Q_DETAILS(*sq, ntc);