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=1796354493; b=yvXbz6F+dqNJmZLq3OdXUJVGkb2sgUT81SA6FlKGSBdpLnQ0YgS9vR+AR3sK/y8od2Ow E7FG+uDdGKeiC7C9iPlB4ZFcL51zM3B8/t5uiaPshVlqz11v4n+AMGY3HqWKTV5V+O6yF Lw0lF+/eAVJpyxtrlfT/pgDTIoXokbH11jWKMKXP82BZp0lQWGp59eh3l1/bFeWjgywET gPeJvuEzxQej414x6xVUxffOu3r1iWs1hi+mI/n56PewkMgy0tzggc5bEzKvsy6hmIA6I cwGEhVu8x7EQaWRbvPtF3JJU+kujcCZZWjF7DUNCRfHqc3qzzbVxsHJOa/VSvdRtTYA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796354493; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=9NNmayqgy125VMAJF/I3q+7oKYIOjBYrGDRKC4wIF5o=; b=NkExW1az1sVxdFhlHkzXL5BoYaWZ1mQJN5ezKgAbkQhJUFoN2YnTBWvh5g+0Dnd1vL+a Tsfmk/e2K4/c9Nk89Pb5oASrdQcq9me6MrvNSlK6BA/GddxiIqeQSHCAFOHVPsnhgfG86 6FoT7zAPm+5FtPHLhrfQaqSH9bmS6p2zvSR6t3vHAjc7DiFFlAxjfct83LBfO/TwixObZ rZZLrKvNZOu23RIVKp+CdG1HWo51ZzuCIcEKce8aiS9aA/SZxu5ypsQLZsNBi/1YNzCj+ pWhGnu9ku3vuQhxM/XIZCu/bjwvkYvWNGIqrPQesZkx1U3NPBb0UjXFpcIZfVK3Otwg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=W3o3Bbm6; 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 AED3B606A32C for ; Fri, 4 Dec 2026 03:21:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=W3o3Bbm6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DD631F00897; Fri, 4 Dec 2026 03:21:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796354493; bh=9NNmayqgy125VMAJF/I3q+7oKYIOjBYrGDRKC4wIF5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=W3o3Bbm6yFOvfFHb/GYtM2c0Wf8hRgMv29iXlGEnCZxPeu2D3d18qyYupYiDkGsZr pBuaUrmk6Yvigel+BrhTG6p0ULsVV7qogxbldlJcxXACLeuPoha2pdlBjy10HTGzex 3r3k9b8sOXB4/7jkbhqoBLGBXsuF87iDKDkud+19U/xg1Lh+TgNjf88PQBGk0DS7JX 4i7h52WKSRayZ/0GkEovnKdX19BfTdgrvWN0dH9Vll0XNc98rlzw1tt40186azMtTf Ft1ygZTFMZg6APWOVFOVDbVlmXxWlNVy6l7mD7Jww5xTmlWr/clSDrOBPweW+LM7iY t4S+9FOGpZBiQ== From: Sasha Levin To: stable@vger.kernel.org Cc: Filip Balluch , Aleksandr Loktionov , Alexander Nowlin , Tony Nguyen , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.18.y 1/2] i40e: fix freeing of TX rings on RX allocation failure Date: Thu, 3 Dec 2026 22:21:30 -0500 Message-ID: <20261204032123.2336779-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026120209-bamboo-bacon-d27f@gregkh> References: <2026120209-bamboo-bacon-d27f@gregkh> 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 From: Filip Balluch [ Upstream commit 4957f668681a2e1e2dab4731d75a2c53c6017319 ] When ethtool -G is used to change ring buffer sizes while the interface is up, i40e_set_ringparam() allocates temporary TX and RX rings. If the RX ring allocation fails, the error path at the free_tx label incorrectly calls i40e_free_tx_resources(vsi->tx_rings[i]), freeing the live TX rings instead of the temporary tx_rings[i]. Since the interface is still up, the next TX completion interrupt causes i40e_clean_tx_irq() to dereference the freed ring descriptors, resulting in a NULL pointer dereference in IRQ context and a kernel panic. This can be reproduced on systems with Intel X710 NICs under memory pressure, where the second port's DMA allocation fails after the first port succeeds. Fix by freeing the temporary tx_rings[i] in the error path instead of the live vsi->tx_rings[i]. Fixes: 74608d17fe29 ("i40e: add support for XDP_TX action") Signed-off-by: Filip Balluch Reviewed-by: Aleksandr Loktionov Tested-by: Alexander Nowlin Signed-off-by: Tony Nguyen Link: https://patch.msgid.link/20261113004602.129864-3-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski Stable-dep-of: e3916fa03f4d ("i40e: avoid resetting BQL state when freeing temporary Tx rings in set_ringparam") Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index 61c39e881b008..ab67121e0ec46 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c @@ -2250,7 +2250,7 @@ static int i40e_set_ringparam(struct net_device *netdev, if (tx_rings) { for (i = 0; i < tx_alloc_queue_pairs; i++) { if (i40e_active_tx_ring_index(vsi, i)) - i40e_free_tx_resources(vsi->tx_rings[i]); + i40e_free_tx_resources(&tx_rings[i]); } kfree(tx_rings); tx_rings = NULL; -- 2.53.0