From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB1D33BFE38; Thu, 15 Jan 2026 17:26:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768497998; cv=none; b=JRJKNRLGQfL9pZRjUrWixCaJFZyBFzsKq9mnOAxsEOGPvpId2+H59mXY4UOoMuSyHFv3D6yQnJhDaYX906krFDYe1u0OF+XAVgXpZfXVv1rPoA/0P+XtiK8GUaA8LKSRmodtjbPSeJZq7+zpu1S1WcQSy8NEcOHM+mdp/jTl+S8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768497998; c=relaxed/simple; bh=XLGFZi0AjP5kXaLt7pZedWbmE8ZROUbJ/dTTGI4oMvQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e6mvOOCQmt+YjP1Ownn+zmITmktkpITibx9AgMC9DaRPOLql3DD6hFNMwpw356tGBLYm10RAOdEpq8pp2/pwGBkT6gzL3RlLdwGjwcTInUqGfqCk3avzr8WVcHvfiRWIy/wPbGV0xWzueCNLkAMKaB6JU0MzphEfCg6V/E1OZuQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=l4hd27gM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="l4hd27gM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3523BC116D0; Thu, 15 Jan 2026 17:26:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1768497998; bh=XLGFZi0AjP5kXaLt7pZedWbmE8ZROUbJ/dTTGI4oMvQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l4hd27gMgW1ITy5YCrTKp1uzxjoLCeU0psDi1IM5lrjPRPjYlejyGLvHpLfJCqOj/ JNfRdZ0OWQBlWv6M3kFv+YNWGSohzgTd9D5Dv4Y8c9LmKDDdFTfYARKa+N+d67Wta2 yjaRIQ2C7QD6Ich160tJRjjXyBjY5m648pwa10so= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jian Shen , Jijie Shao , Simon Horman , Paolo Abeni , Sasha Levin Subject: [PATCH 5.15 244/554] net: hns3: using the num_tqps to check whether tqp_index is out of range when vf get ring info from mbx Date: Thu, 15 Jan 2026 17:45:10 +0100 Message-ID: <20260115164255.073698447@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260115164246.225995385@linuxfoundation.org> References: <20260115164246.225995385@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jian Shen [ Upstream commit d180c11aa8a6fa735f9ac2c72c61364a9afc2ba7 ] Currently, rss_size = num_tqps / tc_num. If tc_num is 1, then num_tqps equals rss_size. However, if the tc_num is greater than 1, then rss_size will be less than num_tqps, causing the tqp_index check for subsequent TCs using rss_size to always fail. This patch uses the num_tqps to check whether tqp_index is out of range, instead of rss_size. Fixes: 326334aad024 ("net: hns3: add a check for tqp_index in hclge_get_ring_chain_from_mbx()") Signed-off-by: Jian Shen Signed-off-by: Jijie Shao Reviewed-by: Simon Horman Link: https://patch.msgid.link/20251211023737.2327018-3-shaojijie@huawei.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c index e2cd0eb124bac..f1823dd4473f7 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c @@ -187,10 +187,10 @@ static int hclge_get_ring_chain_from_mbx( return -EINVAL; for (i = 0; i < ring_num; i++) { - if (req->msg.param[i].tqp_index >= vport->nic.kinfo.rss_size) { + if (req->msg.param[i].tqp_index >= vport->nic.kinfo.num_tqps) { dev_err(&hdev->pdev->dev, "tqp index(%u) is out of range(0-%u)\n", req->msg.param[i].tqp_index, - vport->nic.kinfo.rss_size - 1U); + vport->nic.kinfo.num_tqps - 1U); return -EINVAL; } } -- 2.51.0