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=1796384035; b=S4ZasDLqQYxfqGhHPDiKKLIdAZgvlGVSKt063zbZFZiBa2eTrjkxlsjiAa943baTg/0o iw7S5LeW9ZiKxqxBeWQLPcGzZkckQTEhnLxmi7vAVJ1+YoPY7Hkt3LLHspj32JxerzAoC 5BXsPrgTrG0kabs/cmX/q43Lg+srAlAE8sYY/SzUvW0N3muMZGYoA0T4DpWba2b2kUyLa KhhymdWAYYuDCgD0LTU34nM6MFSoLCJfnHlVz5dOnZkWV9SyVTBzBgeFB9cPPcqGBNrQ0 zGUoZLP9xR+vJY4wDQAGjca7gjpCY5ADZheu9+YoyGCRg6XZGpVIM6vr3FGqu+1IqbQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384035; 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=evPGyVk7BIhKevsstJwcq5D27zmDJpErlPcWnR9NKkI=; b=YHj5RzrTbWaljIPXqsec7SJcHyvs72dAozvCwdvIMd9LxfMjACMNvh9P6F0CxFauA9dG d/AkGuUwfN4s7Iosd+lDbb0+5hPYh7BtMB3d8EWNUUo3B6xY0GiV1Z8OoUggDTZ5NGiDX tDGGK9V8005AOLo8FpXSSVV6YHnSfsqIDKs5HA0Wjj76JirdfkRQhr/CtXtTYnCYsSwJl /aE37zzQXKw+AK+9MLDS2TimAnPkUeNuLqFOAubmVE9AZ9DnVFWz1zZDtHFxaFPJGEZ4F SEUafFK1HNn2AEaAEl2knbsa2UFIh8gqpHhe4XWuczK0iwgBaszZjAQEAVOs/6XutCA== 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=mELXZF1q; 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 207B7606A33B; Fri, 4 Dec 2026 11:33: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=mELXZF1q Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FAA31F000CE; Fri, 4 Dec 2026 11:33:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384035; bh=evPGyVk7BIhKevsstJwcq5D27zmDJpErlPcWnR9NKkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mELXZF1qrsFXxuOYtt+5FKf21i24yvmZpwcpwHqKm8X1SyqrV8gZkNywavamD4OFr 91REjs0ZGB0otfVR7eIAoUvtt5VsfqOeuKHBVdYIo44zwwPNbCEYB1fRuNOQDqLPhG uz+QWUdkTCsSZ3PkoiAQ3XMXTlPr/r76rHXS9nO0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Anthony Pighin , Daniel Machon , Jakub Kicinski Subject: [PATCH 6.12 469/555] net: gianfar: clear the pending Rx skb when freeing the Rx ring Date: Fri, 4 Dec 2026 19:08:32 +0900 Message-ID: <20261204100627.168853177@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: 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.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Anthony Pighin commit c35761f43c582460b45429f51be5c2a0f07ed9af upstream. gfar_clean_rx_ring() keeps a frame that spans several Rx buffers in rx_queue->skb between NAPI polls. When the interface is stopped (close, MTU change, reset), free_skb_rx_queue() frees that skb but leaves the pointer set, and nothing clears it when the rings are set up again. After the restart, gfar_clean_rx_ring() picks up the stale pointer. The first buffer it sees has RXBD_FIRST set, so the overrun handling frees the skb a second time. By then the skb has usually been reallocated, so the second free releases another owner's skb and data while they are still in use. Clear rx_queue->skb after freeing it. Hit during development, as intermittent kernel panics in our automated regression on an NXP LS1021A board (eTSEC), in an L2 Ethernet traffic test that shuts and re-enables ports. It was seen on 6.6, 6.12 and 6.18 based kernels, crashing in unrelated places such as kmem_cache_alloc() called from build_skb() in gfar_poll_rx_sq(). With the fix, the same test ran 90 bounces with no warnings or crashes. Fixes: 75354148ce69 ("gianfar: Add paged allocation and Rx S/G") Cc: stable@vger.kernel.org Signed-off-by: Anthony Pighin Reviewed-by: Daniel Machon Link: https://patch.msgid.link/20261112143140.1395197-1-anthony.pighin@nokia.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/freescale/gianfar.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -1104,6 +1104,7 @@ static void free_skb_rx_queue(struct gfa struct rxbd8 *rxbdp = rx_queue->rx_bd_base; dev_kfree_skb(rx_queue->skb); + rx_queue->skb = NULL; for (i = 0; i < rx_queue->rx_ring_size; i++) { struct gfar_rx_buff *rxb = &rx_queue->rx_buff[i];