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 E8E9234104E; Thu, 2 Jul 2026 16:36:30 +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=1783010192; cv=none; b=buGnOA3IXalPc59Jm2uFBgsutDBZiOSK9kQ+PfwPErJhkcTKS1fmv/3WloVSSHW/HxP1lxaohPqqJc1LIOs6gBg+M5REU9pEsmxPq6jazkcg0edFAWgZIGmrARnsEOvVdqBksBQG3bUexKGNR6D1FhOuwWaKpwr8iImPfdGH+Mw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783010192; c=relaxed/simple; bh=r1Cayh8Tfna3O8/A+oo4wCiNb6kIcqNnbD8ga9eponY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Jpn6B5yTjjNoNPVHdj1qxfvfNS6z9ZGeLH3Skp9xGUsLBbY82IcLFo1amHhU2mKkJsO7xkCayOCEWpwMK29Bi0b3FikwJ3qDo4LP2yv0yZUG/hJOlGTydPmRkrr+oo7XllDaFv7S1x4D2s/c/tQOUQAa643FWacBtaoMPwrvV6c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ayFQVhld; 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="ayFQVhld" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FCB31F000E9; Thu, 2 Jul 2026 16:36:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1783010190; bh=KhYdM/QtufApfSqcO8U8/6Z+/Z19CMk5CqWg2YhRXHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ayFQVhldeuGNGkJ73B7DoQjrTHz0PfWoYNHcqxNep7aYAYdtpL0V9GAq8DnBI8cJi y30rAWB3RzihjYjHCII35CZUP7ixIR3zOjj4Rr+vDwsioJAJ6p/tt1zsuljp3qP4GN hn9BkquxTJcQ2FqaM3n0mEOub0oipQ/Oc2hCFjnU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Quan Zhou , Sean Wang , Felix Fietkau , Ajrat Makhmutov , Sasha Levin Subject: [PATCH 6.12 003/204] wifi: mt76: mt7921: fix potential deadlock in mt7921_roc_abort_sync Date: Thu, 2 Jul 2026 18:17:40 +0200 Message-ID: <20260702155118.740854880@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260702155118.667618796@linuxfoundation.org> References: <20260702155118.667618796@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: Sean Wang commit d5059e52fd8bc624ec4255c9fa01a266513d126b upstream. roc_abort_sync() can deadlock with roc_work(). roc_work() holds dev->mt76.mutex, while cancel_work_sync() waits for roc_work() to finish. If the caller already owns the same mutex, both sides block and no progress is possible. This deadlock can occur during station removal when mt76_sta_state() -> mt76_sta_remove() -> mt7921_mac_sta_remove() -> mt7921_roc_abort_sync() invokes cancel_work_sync() while roc_work() is still running and holding dev->mt76.mutex. This avoids the mutex deadlock and preserves exactly-once work ownership. Fixes: 352d966126e6 ("wifi: mt76: mt7921: fix a potential association failure upon resuming") Co-developed-by: Quan Zhou Signed-off-by: Quan Zhou Signed-off-by: Sean Wang Link: https://patch.msgid.link/20260126180013.8167-1-sean.wang@kernel.org Signed-off-by: Felix Fietkau [Ajrat: keep del_timer_sync() instead of timer_delete_sync() -- the timer API rename is not present in 6.12.y. ] Signed-off-by: Ajrat Makhmutov Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index f2fffca868b519..99561094640f19 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -365,12 +365,15 @@ void mt7921_roc_abort_sync(struct mt792x_dev *dev) { struct mt792x_phy *phy = &dev->phy; + if (!test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state)) + return; + del_timer_sync(&phy->roc_timer); - cancel_work_sync(&phy->roc_work); - if (test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state)) - ieee80211_iterate_interfaces(mt76_hw(dev), - IEEE80211_IFACE_ITER_RESUME_ALL, - mt7921_roc_iter, (void *)phy); + cancel_work(&phy->roc_work); + + ieee80211_iterate_interfaces(mt76_hw(dev), + IEEE80211_IFACE_ITER_RESUME_ALL, + mt7921_roc_iter, (void *)phy); } EXPORT_SYMBOL_GPL(mt7921_roc_abort_sync); -- 2.53.0