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=1796380221; b=e4a1LkROGaXkhvJkYBXynR1IPJqmymIB/DQRdOrAwgygTebpKotmlnPa1fQvQLYOELoY kZsFpChaj/4aS7nggyhLECTHkX4CKi+vAsXxi8IA4r/pVhNYEEwr3ecoqyvCLI+gHKCZk ZZwsBnCLlx422nX1oF41qpzdwD/k+XvrHcxM/LaLdp0qYWkkw2m0GMaPJeAI3/TFc1KL5 3XZU8+q5X5g/fFtseyrG6MxBD4QfdSa/hvPvbJ8YGGlBi/wMONfQtp0iL8OsygbeaK0Gc xZrXfkC7IV3upIArgJduzYMGRYj4Xx8F5yhbyFKEGw+MwVMHvC1RmxTN+yU3OvVuZnw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380221; 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=YR7ryZhGHs7ECSnpV565UMXqOOFuVQ5FL4ANg9Hhpv8=; b=kfijKX7l/hd615QevJiqMM9/cuC/MiHsYVBL8RkH2hhBjc319ihQxCTTFuG9hLEhQfSZ CHm4HkhoUMrancfuxUpzmyCVGAKNpZNcRF6drXiwILmLsBAKvV2wg3JkZkruoDG1uT2d+ Z4ouXHLVrZrhcSH9PWf5OyNkq/++/khofOzXBW2Pj/OuATBJho/96iVsIhf6/8h223BrF 9MAwOPzvRkTYEbijriOR9w/iHHveAQdY3HFD+56gEtvHoUzEC08xvviZTwYCp5I4JXS8j YR9ZGMz6Do5bmgsUj6wji1+asU9t6GAu6U+QnjGfk6PUUvi4FtGFOXT+7gLXCg3BjDQ== 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=Pv0I7Wag; 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 F2A99606A332; Fri, 4 Dec 2026 10:30:20 +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=Pv0I7Wag Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EBBF1F0092C; Fri, 4 Dec 2026 10:30:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380220; bh=YR7ryZhGHs7ECSnpV565UMXqOOFuVQ5FL4ANg9Hhpv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Pv0I7WagHanZ+enqSQ/OU/NL/kQc4dG44ikoYTUEYsJQAq4VKPJ8m5GnhOMupv+hG p1DFAhrBeg+FoXLZV6D7MrD0jz8btTKGP9daAoFZeXJvOnKUoL2ivB/f9NI1X3+ixO hbOC4AxKRXdgD+CwdDqIS/LgdbtGNGXfyPpExGIA= 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 7.3 138/742] cxgb4: allocate the full ethtool filter location array Date: Fri, 4 Dec 2026 19:00:02 +0900 Message-ID: <20261204100638.791249193@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-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 0092bc16f8870..c72c0bcd45c80 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c @@ -2269,7 +2269,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