Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC4A2471250; Tue, 21 Jul 2026 18:41:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784659275; cv=none; b=mlfX3uHPQjvF8JnLtcP3wmuTjgzoRPahqI8yzS1Ve/F7Lv7db+td3wMfHwzsktVCNiFCtXKGevcktNlr+oNXjJJDLTP+lVGJrUTia4MBlmX4EacBI/Iv+W09WvyPWyhS+f3mqfyr7ml87x0vUWmrTJMxAZMzRer5Y5dT8OSeDvU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784659275; c=relaxed/simple; bh=J4H9kWHJGo2BmS4VGoIsqtVgJvsMfzz0iXEpAZP8WMg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RiHqQau4SOqKP6y9UPJfufpQ78GYIvlECufWav8KnbssePNz1AD07cnLEutBN9Un2LOoWbG0zlDFz+oT+tkvzx+EAzmnBLj6kRBR25TnvwYcMRS3sNUG2iKMlnchjw+0T2GRpwr1iC507S2ppuABkjMrzIMPKmOQMBilCJVKBaU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=C1hauXCb; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="C1hauXCb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F5261F000E9; Tue, 21 Jul 2026 18:41:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784659274; bh=0yFa2toWeW4cqslCSz9why6T+Wzt+l9B4Kblpb6r0bc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=C1hauXCbbt1wGFKpip8tilMFC6UCOT5NRkCOGNZPy9WubnfR5ORtxJka/IESQCRLr JrqA5szb5GhhRTGNqXMi5GycD1G+IDaC4dbULeS5xs5jxeid47Qd77xYG+UWkaZ7UD tmFGn/vxFTInMI6AhURIUTM8W5vYXIJZzK3pp2qA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Nicolai Buchwitz , =?UTF-8?q?Th=C3=A9o=20Lebrun?= , Paolo Abeni Subject: [PATCH 6.18 1459/1611] net: macb: drop in-flight Tx SKBs on close Date: Tue, 21 Jul 2026 17:26:15 +0200 Message-ID: <20260721152548.264149823@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152514.750365251@linuxfoundation.org> References: <20260721152514.750365251@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Théo Lebrun commit 27f575836cfebbf872dec020428742b10650a955 upstream. The MACB driver has since forever leaked the outgoing SKBs that have not yet been marked as completed. They live in queue->tx_skb which gets freed without remorse nor checking. macb_free_consistent() gets called in a few codepaths, but only close will trigger the added expressions. In macb_open() and macb_alloc_consistent() failure cases, queues' tx_skb just got allocated and are empty. Fixes: 89e5785fc8a6 ("[PATCH] Atmel MACB ethernet driver") Cc: stable@vger.kernel.org Reviewed-by: Nicolai Buchwitz Signed-off-by: Théo Lebrun Link: https://patch.msgid.link/20260702-macb-drop-tx-v4-1-1c833eebdbc8@bootlin.com Signed-off-by: Paolo Abeni Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/cadence/macb_main.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -2589,8 +2589,25 @@ static void macb_free_consistent(struct dma_free_coherent(dev, size, bp->queues[0].rx_ring, bp->queues[0].rx_ring_dma); for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) { - kfree(queue->tx_skb); - queue->tx_skb = NULL; + if (queue->tx_skb) { + unsigned int dropped = 0, tail; + + for (tail = queue->tx_tail; tail != queue->tx_head; + tail++) { + if (macb_tx_skb(queue, tail)->skb) + dropped++; + macb_tx_unmap(bp, macb_tx_skb(queue, tail), 0); + } + + queue->stats.tx_dropped += dropped; + bp->dev->stats.tx_dropped += dropped; + + kfree(queue->tx_skb); + queue->tx_skb = NULL; + } + + queue->tx_head = 0; + queue->tx_tail = 0; queue->tx_ring = NULL; queue->rx_ring = NULL; }