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=1796389043; b=wnsKtUq1Sk2pe4to5jSkPbp4tK1Z8PKEyyoAwWeNqfQanc+3qzDNAIq1eCRjWuEn1eQr MQPLVFiH/GAb34d1b/PbqIDSFtNgmfA7oYqGrdYyp6j7QHFJqXOBTxKAvvloLfXzRI3xt IGWf4K5Bt36xY8CsGga1oMv4lOG3O9ev9Qz9wQ7c2JtUwPT6nWdKjAwNmnu+SzqYYwTdM eOxrV5iY+k1/4fNO7UcvB5ttIEyQye/ubbJPvlkqsw/ByW962ozrjkNMoJg5fXXUQRGK2 i6AGeBseIfxmcIYkbayace0hrOH5Ee3Drj4wwtIATOkQoz9jV0Hp3buA97Il/JSKrkA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389043; 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=0AJhLaBLo3/5hrBJdb50PQur8tAJ5VoIpP2mt3g06v0=; b=FkK4on4Au7vQKp7xSY+Bu4qN917EEFMzwLG3JDb5dEkOvOTv1UV4YujWB2MdRbqsu/AW 4JeP62wt3xQi94uDJcWlhsN/InuRt1cy9hypnmx1g9j7GRHJEgRAYwyo27+nJ/wYQbL5G /x7/VoSjG5J74p9G14LwSL0LU5p8r5biRu2ZXgnT6DqTgx99AZftNETHFOxJcT+7K0XZJ fodCo0JSKQFfCl+GsLAQKfHLKjHogiMpR4wejUnZ+d7Vj0rhr/y4NlEoCh6K5Dgr9veMU QKMg4L1MVeEK/AkBcxvgkAEUILZDPtrPXpjFyrM+CTEj0E3DlomNmWo0zxSDuw350LA== 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=s13BJ24n; 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 E5905606A32D; Fri, 4 Dec 2026 12:57:22 +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=s13BJ24n Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6FA91F000C2; Fri, 4 Dec 2026 12:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389042; bh=0AJhLaBLo3/5hrBJdb50PQur8tAJ5VoIpP2mt3g06v0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=s13BJ24nBEOlU2u+1vNeS0e03DcEap2qt3v5VPlQe0/NLV6ANyUdRgzY2zsFJlxS2 8s8o5UuLKA/4K9J+daj2K89o9rWU5H0McYPvge7SprnPkPWQ+e8HYLIm46FpsfhCpU 6ciUTfLVLwkDpfc16ryXG24qt1IYSHT3qZ1m02jo= 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.1 0805/1059] cxgb4: allocate the full ethtool filter location array Date: Fri, 4 Dec 2026 19:05:36 +0900 Message-ID: <20261204100704.880774262@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@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.1-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