From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796381812; b=K1rX9kV0jvkt1oi7/VzbAzpjRaKqihPdGA/lLGi2bCArhnTgB3VhGRZBokhss2vnCFmf u2Ame5MPWOjhzXRJX9HPeHMK4+CE2SSFudB6SLrI5WGRNh790dVUP22hIX7v7kTrx91Bb XVXWBGMGTyHV74lZXAzxn6fyN9nwLIE3IhQAdQfRWY44NG9/mkn3h3+Ery+ruNbVH09+f RQ6qIgOADxrOAxB0sVvPqU8IjmUcJVLGskM2jvtFcbJwZPOeckUGek7ndNMhRmVu1iZei aGMHnCbqD45w8uEz7vzFWJ/xWf8uySNd0DzPb8QZx/JdiUjOATB2N4ZHmQpsuLlZQXA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381812; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=LX/BLhhuAEmBuRVe91kS3nh4ZLZ4g/iVtVyiiK8zO5c=; b=SEl23vH7PIGyqoD0ozgCcWhAxCAGCOo2abI4GGJfW1ai8O0dLeMFwGacOj8htrk9BivW vybI8C5iUFcQm2pwmqRc1jvNw2Q+TzgnfGAJIB5+Vt+w4IGVQGwi7e46XPH2CoytuGLPu wo9AdsryObxhCI7uPdIm+f4PVtoYDw38ntxLrUOgadRZUAuWwYm0bvtyMv+wgHaqGRbxM KOxvGAnBUw7m8KEW8rfietri7Q0s/SyCLY0xpWPnLD+a/p9u32knWGeX+wOIvbGIAtEnH 5++mze1Ot2Jcg3oi/R53slS4RfFjuclG1jUxPaPTvsNdMd0J4YPl3CZce9Ygm1Pxz9Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=zzXVXIRM; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EA3D606A322; Fri, 4 Dec 2026 10:56:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=zzXVXIRM Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDA881F000C2; Fri, 4 Dec 2026 10:56:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381812; bh=LX/BLhhuAEmBuRVe91kS3nh4ZLZ4g/iVtVyiiK8zO5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zzXVXIRMfmbeko5phqWpe9oRHE8ZtAZjPoaPLWpfS3GYNEowNcKRrkceT9MMRUlBj /GB9PnsxKZHv4Bt76GZLm7zTWONqv0DKvf2ZLEQH5fhGg5MA5+TuQyHw82XseqbpFs Ofe8n2iWjah9czRL5TjPXwo/nfz5cirT+G1Rue18= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Artemii Mashanov , Potnuri Bharat Teja , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.18 182/703] cxgb4: allocate the full ethtool filter location array Date: Fri, 4 Dec 2026 19:01:21 +0900 Message-ID: <20261204100632.709118189@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Artemii Mashanov [ Upstream commit ad2c7240a3981fd5f0142b61ca913b02ab476ede ] The ethtool filter location array stores nentries u32 values, but cxgb4_init_ethtool_filters() passes nentries to kvzalloc() as a byte count. The insertion and lookup paths allow indices below nentries, which can address memory beyond the requested allocation. Allocate nentries elements with kvcalloc() and the element size. The array remains compatible with the existing kvfree() calls. The size mismatch was found by reviewing the allocation, the array declaration and the indexed accesses in the filter handlers. Fixes: d915c299f1da ("cxgb4: add skeleton for ethtool n-tuple filters") Signed-off-by: Artemii Mashanov Reviewed-by: Potnuri Bharat Teja Link: https://patch.msgid.link/20261117090608.33178-1-ralerrdirsardx@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c index 23326235d4ab5..bb20ed9e2d6e5 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c @@ -2266,7 +2266,9 @@ int cxgb4_init_ethtool_filters(struct adapter *adap) eth_filter->nentries = nentries; for (i = 0; i < adap->params.nports; i++) { - eth_filter->port[i].loc_array = kvzalloc(nentries, GFP_KERNEL); + eth_filter->port[i].loc_array = + kvcalloc(nentries, sizeof(*eth_filter->port[i].loc_array), + GFP_KERNEL); if (!eth_filter->port[i].loc_array) { ret = -ENOMEM; goto free_eth_finfo; -- 2.53.0