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=1796382662; b=fLBMPoKJ7hYuY8OXLcET8VMTnJIEFmfa4Gycu1sWwEARy8i9IfX339EunW0ccPwfXX3r JIdNYuOL1IgMVNJZ0BGYu+PqjHCIcmxQCSPWiHasMCgn9OyZIoBD6EG7VVQNq0BL/HmLG 18nDpu36vQFfh/jDwe3j4wuj3PVS/2Mm/ATyPfqABBOoP/7Bp4ThuAuX34DM7xyu8r6tc 4DxIqOM+/ILRtucwGAbnI+j3/xsASnQpLaIaJ8ATVLJ52cUFAhcT8tZWR4qn3HS3TsCUv J73a7lXE0nXX72BboSBP9K9WeVTRGFyJHTVGyXl6zJd4STwEe29HypfCJ5r18iXBwcg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382662; 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=MYz6769Wy3D+C5uxkFgH1owwnk3jNpzw0r0uBSZMaZU=; b=mmrAGOI5EJeJY+bDYyloFAJ5kJ8/Wwn1FHK4gq6H34l+3jaR5ZrVgRyUJrsB53XUWGx2 W0gvzpRQUNd0SBPUBXBfe8oTmuEtE4XiswbpxSX5SBdqSJA4+1lSa+qPu9X2WTcUO2aXb 0VCrg71ngAEKVRIxKBuGtkVHANxnUGrReIQOP7jYmU5yXO3K1Wds39C/xUTxXvMb+Xf5T FJhcet+V5Pnh0GLZw2Hd0tF4QqTPr9yuGj4NmC8QLfev56arI4yCxE8HVlHeGnglpfonl nVEnR3v9yKFwg658o344yS4jtsgGN0BFqhQDh36dj5S/reYX85aKZ3a4iyVJ4XxCcRQ== 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="ynpr/qnM"; 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 27D0E606A32C; Fri, 4 Dec 2026 11:11:02 +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=ynpr/qnM Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90CD51F0092C; Fri, 4 Dec 2026 11:11:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382662; bh=MYz6769Wy3D+C5uxkFgH1owwnk3jNpzw0r0uBSZMaZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ynpr/qnMfz3NKgz6K+7hC1KD9LON45akX0c5soFgehsDXt5VI19hP9caAs/73WV8R Pv3GK7Zq1sa2Q7Qja764htHocHMerjC4xwQtkQIOTUXH8GanxX3UXMJjNGry9l0XfA rVvBAeCLC87jvT7nEA9EciNtqtfQ/E8saEcj+BgU= 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.18 551/703] net: gianfar: clear the pending Rx skb when freeing the Rx ring Date: Fri, 4 Dec 2026 19:07:30 +0900 Message-ID: <20261204100642.438416635@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@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.18-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 @@ -1095,6 +1095,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];