From mboxrd@z Thu Jan 1 00:00:00 1970 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 9D69136A357; Wed, 20 May 2026 17:21:38 +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=1779297699; cv=none; b=onYwyqRa4lrWHnsDiwpBdKN8XOL/xe/50wnurMnZxOePZzFV5syk9ssm5Hl4DuPsxDkVup1p5exUyy0T8OoW5XP1vkRPsCj5ARwZgVAaN89aOzNNGs6Er0jvxOGw8PA0RQn79pFhkJNL6YSwy18/1V3Nc5YTAIhoLaB7zvqSTrY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779297699; c=relaxed/simple; bh=sPbOMyc1jHLUYNktxgFfqztroh/m0wH0cwZqOhgprWw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bEVzmZhFd01xWN6UQFDrwxa9XMNMDdYZClJFe3hIHn2sosLZRyhyLVO20HY++sG3u9fFPhtndMjNPESBeGB9jfWxnCo7V9Ou9GFkvMSlgZau3qjfadbkQoQska9yOwD00J/wrdDAnMb2uPv/XIQHNmvwuU/DLMcFuX3Px8Hbm/A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xz6XXZ3f; 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="xz6XXZ3f" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EE011F000E9; Wed, 20 May 2026 17:21:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779297698; bh=P1mRQmRD2sOsVyJXYXHF4+Ai4/cbHAWiVaRD9jF4JxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=xz6XXZ3fBcHevXIntU/xD9uvoNumRCMPgBTycP1AdQ24L/TA916PfJvOS7yCmOWNz 3tcepJ4FkEGJNUoDdHSypMXyNjCwn4AF6mZvbcpGdGyZMmw2qzaZhxqGQHax5Qphw8 rUWX9TqfiXvzi3vvwhPuQJsXgjH2U2BAO9sKcFao= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 6.18 088/957] wifi: mt76: Fix memory leak destroying device Date: Wed, 20 May 2026 18:09:31 +0200 Message-ID: <20260520162136.469171398@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162134.554764788@linuxfoundation.org> References: <20260520162134.554764788@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lorenzo Bianconi [ Upstream commit 6b470f36616e3448d44b0ef4b1de2a3e3a31b5be ] All MT76 rx queues have an associated page_pool even if the queue is not associated to a NAPI (e.g. WED RRO queues with WED enabled). Destroy the page_pool running mt76_dma_cleanup routine during module unload. Moreover returns pages to the page pool if WED is not enabled for WED RRO queues. Fixes: 950d0abb5cd94 ("wifi: mt76: mt7996: add wed rx support") Signed-off-by: Lorenzo Bianconi Link: https://patch.msgid.link/20251208-mt76-fix-memory-leak-v1-1-cba813fc62b8@kernel.org Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/dma.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c index 1fa7de1d2c45e..9ef073c27f309 100644 --- a/drivers/net/wireless/mediatek/mt76/dma.c +++ b/drivers/net/wireless/mediatek/mt76/dma.c @@ -878,7 +878,12 @@ mt76_dma_rx_cleanup(struct mt76_dev *dev, struct mt76_queue *q) if (!buf) break; - if (!mt76_queue_is_wed_rro(q)) + if (mtk_wed_device_active(&dev->mmio.wed) && + mt76_queue_is_wed_rro(q)) + continue; + + if (!mt76_queue_is_wed_rro_rxdmad_c(q) && + !mt76_queue_is_wed_rro_ind(q)) mt76_put_page_pool_buf(buf, false); } while (1); @@ -1169,10 +1174,6 @@ void mt76_dma_cleanup(struct mt76_dev *dev) mt76_for_each_q_rx(dev, i) { struct mt76_queue *q = &dev->q_rx[i]; - if (mtk_wed_device_active(&dev->mmio.wed) && - mt76_queue_is_wed_rro(q)) - continue; - netif_napi_del(&dev->napi[i]); mt76_dma_rx_cleanup(dev, q); -- 2.53.0