From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385964; b=4mkwejiExOsMwWoyHOlWzx6U6LOcEoVfxuo28N19caFKN8AOSfSS7790/FFfM2AI3DN1 nVvN7zjr0Kc2cDENxdWnLNO7HC1b72JLRmtp4/QkcMqgIj9UxgcTBG0cSMImRxFW0JIjE Qy9A83XCOtEhOEMYNh6SitK4SgxdKb24l5sYTVzMZ74ih3W+YSwPP4ok2Fnsi8B1/qD2P EodJ2uF02Ms0OXLiVP1Ry1WGLKZalzVgT2inEMoE5z4hRWtBhpVAD2WkMXvr2muq3f/UC 4br4+oah9IwzLn/FEhi8vVEJohUfih0775MOMGyfNoDsdQ+S92rym/6UMHXw7U0QJQw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385964; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=szRLjLj8+2sRCKA4pI3dd22UmW9JQG/mY+TIBCDCwl0=; b=B1IdU9aWBdoPXPB9mHfnB3uJQ2xaMv4zdqfFXb9XYPZjJupSOnn7thEAvCIvV03zWras DaPu866WTRyH6b8Q5yWOF7vProhsA6diRiA2oyr469qfdycR6GGx4dKXZGzZq03tHIErk 0YpoNe01pkRz2fvzAW4dF3ZtvKv2H+CHt0AAcsIbFWoM6jiaC4Mrmyned+wwQ/CpWvkyU ups14Dgzlk0BulV2IAWxs8ALCCZWIWasmnnO3NbaP6dA6++k+woC1hJic3iAvoa6yEH/P MJZvxTgwLDacqfuGtPiGKK0aJj9b2gMiOqhJrjNpcpJHk1wpEfQ/oinXUezzQJSDTcw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=rpU42JKR; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E157D606A322; Fri, 4 Dec 2026 12:06:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=rpU42JKR Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7959E1F000CE; Fri, 4 Dec 2026 12:06:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385963; bh=szRLjLj8+2sRCKA4pI3dd22UmW9JQG/mY+TIBCDCwl0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rpU42JKRX1sJQLkcoOe9lMhC7OI9BA3W9ac6/51tXYWyVgo2bgBA7W6V4ct50P2TE WPn9lpmTLlgiUn43GRHX5MybhMUC9N+KwOxbXKdaOVPTtKxUXCsq5hN9RZogYmwdLi rrkFv3UfMhyZqITnTsmuLiiYyT/VU/fJ0IDyMuLY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Felix Fietkau , Dickson Wu , Sasha Levin Subject: [PATCH 6.6 0726/1167] wifi: mt76: mt7915: clear wcid mask under mutex after RCU pointer clear Date: Fri, 4 Dec 2026 19:02:33 +0900 Message-ID: <20261204100720.984134459@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Felix Fietkau commit 6486e11a6e2f679597af2d5bb48c3b07a2b2a7ba upstream. mt7915_remove_interface() cleared the wcid mask bit with no lock held and before clearing the RCU wcid pointer. The mask is a non-atomic RMW shared with the allocators, which all run under dev->mt76.mutex; on DBDC the two wiphys share one mt76_dev, so this raced add_interface/sta_add on the other band and could leak or double-hand-out a wcid. Clearing the bit before the RCU pointer also let a concurrent allocation reuse the index and publish its wcid, which the subsequent NULL assignment then wiped. Move the clear into the existing mutex section, after the RCU pointer is cleared. Fixes: f3049b88b2b3 ("wifi: mt76: mt7915: allocate vif wcid in the same range as stations") Link: https://patch.msgid.link/20260722082610.2699628-8-nbd@nbd.name Signed-off-by: Felix Fietkau [ adapted to 6.6.y: context only, older mt7915_mcu_add_sta() call ] Signed-off-by: Dickson Wu Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7915/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c index 864f636666e58..017181c1a2ea3 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c @@ -306,7 +306,6 @@ static void mt7915_remove_interface(struct ieee80211_hw *hw, mt7915_mcu_add_bss_info(phy, vif, false); mt7915_mcu_add_sta(dev, vif, NULL, false); - mt76_wcid_mask_clear(dev->mt76.wcid_mask, mvif->sta.wcid.idx); mutex_lock(&dev->mt76.mutex); mt76_testmode_reset(phy->mt76, true); @@ -322,6 +321,7 @@ static void mt7915_remove_interface(struct ieee80211_hw *hw, mutex_lock(&dev->mt76.mutex); dev->mt76.vif_mask &= ~BIT_ULL(mvif->mt76.idx); phy->omac_mask &= ~BIT_ULL(mvif->mt76.omac_idx); + mt76_wcid_mask_clear(dev->mt76.wcid_mask, mvif->sta.wcid.idx); mutex_unlock(&dev->mt76.mutex); spin_lock_bh(&dev->mt76.sta_poll_lock); -- 2.53.0