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=1796388592; b=LkaD6MnWipHUos0OIKKE2MKKKFdFEsjHvM8GW0psBI0VTRpFttNJTxZbILMfrVEcZApb PlvV85yGmpEjNUFoHtQVg2/l8/xs9KAkUmRNs1EowlmZyLjwMvyzTNOpRSQ3VYK9RBcrC xS19izkskkMi6n0y3T46vXaYHPbCgRnooCpowzacMZKKE9TgdfSEDK7bqE4NnQR51ZoTK ts1j6yhVcOkHwXCj7NSjKQ+GVmcq0sijRFb7qffDBdH9badXt7VmyBco440JMPYa5GT5R QuTgKOn6w0Muc+45Sxw5z7PlVnrysKoqE3AdRNnnRFCOZpx+Uoxs8QDQXMRTgC9r7NQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388592; 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=KJUaKGQHzRG0Zg1BvKW5hTlekFU0dmsP1KmXn4FJOdc=; b=GV5EMBqh0PdPNY+NSo+qNJTLmg41MWxlqxElgA3KKTPPwYpVL8oqumBYnvsZgRXk0OVe LB6hyaHdxvrzJD5yty6BDD1hNe7jz3VDhQkFZ7pVgJh+0Vg3KQIvpYh8bg2N9GPHJ1rZ0 VGpyk50vAkyHAPyfPqYW8GY/43zbvY5ZhoGeLcHtQqnQ6eXKOuPF/g9GpDx5P5sIZD3/y Mheo3a+/jk49ASU8krXdlOiHuCA9FEzUPNuHrWx6FwrMBaJAE80J2/sXkd5tl+l5HpXx0 b54kdnUFoMDvLRa3ODifvpnYB6oIlWjjsIT5fXKBG7EeRQq0rqNbMSlYs99ijC/GgXQ== 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=E1R9k2R9; 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 DDB35606A335; Fri, 4 Dec 2026 12:49:52 +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=E1R9k2R9 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 515E21F000C2; Fri, 4 Dec 2026 12:49:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388592; bh=KJUaKGQHzRG0Zg1BvKW5hTlekFU0dmsP1KmXn4FJOdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=E1R9k2R97bbV8EPHCWy+clEj3yFuCwS6ZsozlPTlYUMpfeHFNCv431W4sMDM0fLwi 7rVUzowAQ3bu4fcn+UmAf0ASJf/qnzy1JFKF0WofvG75qfZyGl+LAaNztUY6WpoSMI oCjGR1huWrJcotxNMmJzYOYpsXAz+H/6PNk3wVp0= 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.1 0680/1059] wifi: mt76: mt7915: clear wcid mask under mutex after RCU pointer clear Date: Fri, 4 Dec 2026 19:03:31 +0900 Message-ID: <20261204100701.625170297@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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.1.y: context only, older mt7915_mcu_add_sta() and sta_poll_lock ] 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 dde451d818ba4..6ed4c9879b6e1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c @@ -297,7 +297,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); @@ -313,6 +312,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->sta_poll_lock); -- 2.53.0