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=1796383376; b=DKUC63j5HSsQNAgTqAFE+x4eq2HOU7zdEMdOqdQdHxlZDDuvqTQAvFkImqQUdq4cC+y0 2jR/F99rjBHnpNcpScQ0baVnM/dAbyBzSHIHOGSUM5QKra8XI8SKj4ikina6YvGDNXfFI 8uA6DRIOiEBdPD4Pc3axjeVxbLB2elku1UgPmreH5P7Cc+yWIoBKRQUIqlF9cf6s4We8X Sb+/WLYZueme/hTXn5EwE65ElPOI7867ouPmMudAlLtPaag4nD7PZa0OPIXoFcdG6flCb EN5rlkXUEo/V72PZegUyeXeNUgcfK04bPerG2Hm9Ac4eKCnlWBFl/LIoVz+6qNuL0Sg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383376; 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=sLHWud7xTprEZjSrNaK1e9aWysW5Aov304Y9XhuQ/n4=; b=LhqW6LFTEE7DuwumI68/8t5ljKVeYENJkt/PmmLCntK1thNX8bxx2oGPgd8vxWrXL/nl ln1jZMxzNW3A+ygDwN4dAlnhNN36b2eNDgY6DMKxCcVoaRMjRxMgsDFt80bxRsnS5Rpge IgjGFgGNzFnA2aEoiMktETi9+Ryx9SjyegL6acbyvk6XbMegOWcIIfldoc7PjdlSCZ0Fd Ce0Rk1nPUlfJslcpuA+VHctHwbhCk/A4b+iIp1xDl/IrvONU10gjCLhXJRFSEVYy777Be 6WgjtdO5NCwbLIfVWc5fK2Fr6qf+PXXT0nRKXd8qrNvlSANsp0MNKCrdpvIsqTNDxLw== 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=aU0eaA4X; 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 E3A2D606A322; Fri, 4 Dec 2026 11:22:55 +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=aU0eaA4X Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFC4B1F000C2; Fri, 4 Dec 2026 11:22:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383375; bh=sLHWud7xTprEZjSrNaK1e9aWysW5Aov304Y9XhuQ/n4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=aU0eaA4Xnt+Ld3OWZpO98AIyu8/yhCf05iDauUrCAufpKZYXrAv8EoBWqAC7NVues Sq3i0htkgHXL/lpTlB65MMDIZXluetknaowMP0Xv4OtFbODNle81rgX3EVAB0K3ibI aex2hvmL/diyWLT3cy6SBlcYY5GLu91tmUIoue5k= 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.12 200/555] cxgb4: allocate the full ethtool filter location array Date: Fri, 4 Dec 2026 19:04:03 +0900 Message-ID: <20261204100615.870631741@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-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 1546c3db08f09..fe6e9aea3dbd3 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c @@ -2261,7 +2261,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