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 7071738656D; Sat, 12 Sep 2026 18:55:51 +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=1789239352; cv=none; b=lZuQ2WyRaAmRkJMpZBCEA9dc/gONsTk8YMpyTaqGDKsCtFQVqn16Ny8Q/qRpq0uEZXbTHlXbFBSGi/wwdHf5QVFYGT8w1xrsX39/Z6r+WmbzH6NfWgkTfuBlH9OQizdl4rSh4dBgunVbdPdv1SMkinxZ+B9qMouMR+QbJQW84rA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789239352; c=relaxed/simple; bh=YQPySp9emAjz75W+msLiOFB9afeqiBZb5z9TAnb9mWk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kgOuZDL+pKh31QZ3CFjSUJ2SqdOsfJp7Z+jRz6HiigDhwUMB+bpSD7mu9Y1csM1vk6Zf6JfaTtByUvSLS8uswQ+YO46TDvB6Ot5CveSWPNal0/NsWFCOkg7REp4Ef2v7PiOY9SKDbQR2CRRcOxzBOI7qqt8/gIEm6f1CZsByPAw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=znMUVu7L; 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="znMUVu7L" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43AFF1F000FF; Sat, 12 Sep 2026 18:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789239351; bh=7C3Qjh0h+Az/DXD7AXsfm7eTnd8zxjU40Q4sC5T03Z0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=znMUVu7Lw6oCOeSLWytDd40ZP/PDVV62yL1Qjk/afTZPPRzdWOXxGGJrMpf2N+wnG mqM+3oCM35HLnoTDGVb5Y7cjhSEuptdBMlL9EljdFA6aPhQkivjqeLGF4zMT+uAq3M b6NPH2jdleKfmu3UfTz0Hmi/w5Jzpjpwnmi335HM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eason Lai , Felix Fietkau , Sasha Levin Subject: [PATCH 5.15 647/935] wifi: mt76: mt792x: Fix memory leak in SDIO TX path Date: Sat, 12 Sep 2026 09:01:17 +0200 Message-ID: <20260912065541.681605413@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065526.833703348@linuxfoundation.org> References: <20260912065526.833703348@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-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eason Lai [ Upstream commit 808f2767d4217a5b96f674288573b9b89d432eed ] When tx_prepare_skb() returns an error in the SDIO TX path, the skb is not freed, leading to a memory leak. This can occur when zero-length frames (such as WNM NULL frames) are dropped to prevent potential hardware TX hangs. Fix this by properly releasing the skb with ieee80211_tx_status_ext() when tx_prepare_skb() fails. Fixes: b747fa343817 ("mt76: mt7915: drop zero-length packet to avoid Tx hang") Signed-off-by: Eason Lai Link: https://patch.msgid.link/20260703005945.2244533-1-eason.lai@mediatek.com Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/sdio.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wireless/mediatek/mt76/sdio.c index 4964f19558be2..22da8a6dafcac 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/sdio.c @@ -246,6 +246,10 @@ mt76s_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q, enum mt76_txq_id qid, struct sk_buff *skb, struct mt76_wcid *wcid, struct ieee80211_sta *sta) { + struct ieee80211_tx_status status = { + .sta = sta, + }; + struct mt76_tx_info tx_info = { .skb = skb, }; @@ -257,8 +261,13 @@ mt76s_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q, skb->prev = skb->next = NULL; err = dev->drv->tx_prepare_skb(dev, NULL, qid, wcid, sta, &tx_info); - if (err < 0) + if (err < 0) { + status.skb = tx_info.skb; + spin_lock_bh(&dev->rx_lock); + ieee80211_tx_status_ext(dev->hw, &status); + spin_unlock_bh(&dev->rx_lock); return err; + } q->entry[q->head].skb = tx_info.skb; q->entry[q->head].buf_sz = len; -- 2.53.0