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 D8460274B39; Sat, 12 Sep 2026 16:58:33 +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=1789232315; cv=none; b=X2K/GeX9Z1qxMYUXA537uPV07vVNDXAPA+Z5RmW4KfImQ9s3S0DtVVaNlw1xnyqJ1rWaUNI7HFgnamL7UU62MaVfoPRDd6vA+IOPxqoxyzD181JQRiTGNcSKy/lGoaGEWuVDF/hoY58DDb219d/5Ssb3HtxDs7PMk+BbbqLTgks= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789232315; c=relaxed/simple; bh=cTpBaLHS5Yl6X57Iq8DP6MBH9opKn/W3D+fCwhy174M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cZo33fu9cVg2P+Kws4ljdS6LEZPUKW1Cb7dXhS+ic8blduYCrPFUGwMpV6CDFPYRttGzVaXJEUCjyCPGuKBaRbIZFBD7geQhSiz9JxXLxjR8ywua6a/avm6pzoR6W+heFTfCQ3boBrN1ykdxLtbtsLNEFnV2jx9h5+gbg8hc9d4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=B488mLca; 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="B488mLca" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBDC11F000FF; Sat, 12 Sep 2026 16:58:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789232313; bh=lI6Bz6y5tG9XrjI4zqVCHtUpoAX36ibwpXlgD3PDUHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=B488mLcaCHKyPWZhtQCot1QbuDDjHezNqd5lIcraPGZmroI7dXYCla5QASdYdwQqQ r97U+txvCN5cOP3nILmMvWBEYyCEl6htQhY7CLzfPaAURbzYYls6Y10+8tOHfmCtnM Vqk7vf0CTql3o+OSCnQs1nsHXEQpiJOxStg9XSng= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Duoming Zhou , Felix Fietkau , Sasha Levin Subject: [PATCH 6.1 1177/1191] wifi: mt76: mt7915: fix use-after-free bugs in mt7915_mac_dump_work() Date: Sat, 12 Sep 2026 09:05:05 +0200 Message-ID: <20260912065614.575211708@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065548.086904252@linuxfoundation.org> References: <20260912065548.086904252@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Duoming Zhou [ Upstream commit 1146d0946b5358fad24812bd39d68f31cd40cc34 ] When the mt7915 pci chip is detaching, the mt7915_crash_data is released in mt7915_coredump_unregister(). However, the work item dump_work may still be running or pending, leading to UAF bugs when the already freed crash_data is dereferenced again in mt7915_mac_dump_work(). The race condition can occur as follows: CPU 0 (removal path) | CPU 1 (workqueue) mt7915_pci_remove() | mt7915_sys_recovery_set() mt7915_unregister_device() | mt7915_reset() mt7915_coredump_unregister() | queue_work() vfree(dev->coredump.crash_data) | mt7915_mac_dump_work() | crash_data-> // UAF Fix this by ensuring dump_work is properly canceled before the crash_data is deallocated. Add cancel_work_sync() in mt7915_unregister_device() to synchronize with any pending or executing dump work. Fixes: 4dbcb9125cc3 ("wifi: mt76: mt7915: enable coredump support") Signed-off-by: Duoming Zhou Link: https://patch.msgid.link/20260130145759.84272-1-duoming@zju.edu.cn Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7915/init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c index 38027699cad07..7d1e2aa732897 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c @@ -1150,6 +1150,7 @@ int mt7915_register_device(struct mt7915_dev *dev) void mt7915_unregister_device(struct mt7915_dev *dev) { + cancel_work_sync(&dev->dump_work); mt7915_unregister_ext_phy(dev); mt7915_coredump_unregister(dev); mt7915_unregister_thermal(&dev->phy); -- 2.53.0