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=1796386394; b=y3IV0W3TALA1Byi9bqt2w4wC8NGXxCdQkDH3xQkpQWFc9dLo0W/1mDE3LGNBHwt+9ZnS GTswLPLIEViNuQl9g7gskZ/m5YUc7ZbYBdqKiZI6Gf6eNhC6679BUVlOzDc0xbqy33Ob/ tAcvrXe+oQ20eYjIMVw9CJOHsrrOzZjXLlHwhY82wMQpLHi1xaORPkVHCpmrNOlmzVX2j gNIqsaT8aGOXBY1Z6fUIBqcYvXmV9oE59V3UmkP230ovMLdVPxa+SI2P41VzLM7K4vIDk WrWkDGJXOiUxlKIDRjHne0WfG7juQh2itK071tqCiiWMZi+n9rGflVTs644Ove+rdvg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386394; 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=FBe3PR8p539/nJ49OaBn3/rTLXGstRpFCroY+GkLaWI=; b=C0gIUitwg11iWRnCv7sAVJNDYVM+m9A9CEdn5XId4yfetpto4kMyrTVUTjcJJ0KXRgiS V18djoxcT5DapFSO15s53IjXhaYSKNs2QtAQbrLShzTdMfRPGcGuZcJU+xvKgDefyXKbI +hD2CDt0x45G3U8bgMPnbnwV/smEJvfs2kiUmtwRpmoMw+d3P04DbBQem0yWZ+T7NlCL2 ZdK8v+hRxvH+/lANTz6Y8wMY/3v7QyrycBv8HhHiieD1PbQ0J+whetOMj49WOjE8NQCNj rjCPx13xRkeEJocSX/VgrBf+A4VkoZ3o+HneIYp4sq8lP5YDhPFJ1yYtU/vc+k4zScg== 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=Pcy1iPKm; 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 B0CD5606A32F; Fri, 4 Dec 2026 12:13:14 +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=Pcy1iPKm Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA8831F000C2; Fri, 4 Dec 2026 12:13:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386394; bh=FBe3PR8p539/nJ49OaBn3/rTLXGstRpFCroY+GkLaWI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Pcy1iPKm/WJ0TBjaXqmjfQwVHqa0RNxFH2u+dYQ65Hzg5jI9o4//nc9lCu2CwBtw4 yw5Gle+QAtOqrxlXj4Gn1Mli6vgvqSHiDBn8+YPYDTIilHnUSwGdq2oKigMyqyKhS5 eWTEZgqKvxwkgISzQbWMASssjkZ90k9EdwN/QbkI= 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.6 0893/1167] cxgb4: allocate the full ethtool filter location array Date: Fri, 4 Dec 2026 19:05:20 +0900 Message-ID: <20261204100725.459787083@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@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.6-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 b77897aa06c4f..64441342f01a8 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c @@ -2264,7 +2264,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