From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BA6DB2BE7B2; Tue, 16 Dec 2025 11:30:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765884618; cv=none; b=LErY1Wmy/FGfUQXEMl5yNNeHubP9A5f+v9CVfKjqFFyHQ1JYmHG4X931SNmbbUlwPHM9brWqvjii0oRaY1jpdyCe3R3/9h0j+GQdxJuNBa1FRFidfbcbaOFDSZgkDds3BIYSV7FMNfG2XKbufzqAo2ysMzfwNyRuD3atfWGgnpg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765884618; c=relaxed/simple; bh=vR3y+uS5mw03gzKtHe00c6DIhG3IKNJZtG85WSsJkOY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EkK1/huIUl4tESd19EbxRkDG4AeaIIHV7tFRtyhv2vtss9xcT2t7ZM79g/mCbT6S7g7PsDzIJfrprbnzalhb30ETe2VFYtbVzxVQY4B0sALPhk1IZJ4JQ0rMr2UsL8hqnYWJjq5AxZUK5+uIXSWr8lGIWto2VBnT9kenRFXD0So= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=R9zja3n9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="R9zja3n9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47498C4CEF1; Tue, 16 Dec 2025 11:30:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1765884618; bh=vR3y+uS5mw03gzKtHe00c6DIhG3IKNJZtG85WSsJkOY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R9zja3n9bO3mz8gHUwTuFJjqodFeHeI4QU0mLf8rkY6RA2gQ4V6NWfvO2uljg7nui UgDi9gJk06v4JfvG03KrkcF11c3qw7uJeO1Or3pN8xMJjA5HnDqiG3dElorqlKXzmz LDJH3zA2dNpGYSkJGoYtRxX90rRyihmsun7KIlqw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zilin Guan , Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 6.12 216/354] mt76: mt7615: Fix memory leak in mt7615_mcu_wtbl_sta_add() Date: Tue, 16 Dec 2025 12:13:03 +0100 Message-ID: <20251216111328.744474052@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251216111320.896758933@linuxfoundation.org> References: <20251216111320.896758933@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 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zilin Guan [ Upstream commit 53d1548612670aa8b5d89745116cc33d9d172863 ] In mt7615_mcu_wtbl_sta_add(), an skb sskb is allocated. If the subsequent call to mt76_connac_mcu_alloc_wtbl_req() fails, the function returns an error without freeing sskb, leading to a memory leak. Fix this by calling dev_kfree_skb() on sskb in the error handling path to ensure it is properly released. Fixes: 99c457d902cf9 ("mt76: mt7615: move mt7615_mcu_set_bmc to mt7615_mcu_ops") Signed-off-by: Zilin Guan Acked-by: Lorenzo Bianconi Link: https://patch.msgid.link/20251113062415.103611-1-zilin@seu.edu.cn Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index 1cc8fc8fefe74..40e15a0ba95a9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -874,8 +874,10 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_phy *phy, struct ieee80211_vif *vif, wtbl_hdr = mt76_connac_mcu_alloc_wtbl_req(&dev->mt76, &msta->wcid, WTBL_RESET_AND_SET, NULL, &wskb); - if (IS_ERR(wtbl_hdr)) + if (IS_ERR(wtbl_hdr)) { + dev_kfree_skb(sskb); return PTR_ERR(wtbl_hdr); + } if (enable) { mt76_connac_mcu_wtbl_generic_tlv(&dev->mt76, wskb, vif, sta, -- 2.51.0