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=1796388722; b=hTqSliycZCM7oaeK9DxhQuAq1GjaQN8tuvZAZpHQUM+NDnTxQ0GbCMBQdBLmckCGoC79 tNEOvlOMu49kfn/xcgJXLD1E3ZxEiYx1oL57cgJeYQ2hldxfV6X0hl9YUhuD4OjPXHxSq gV7RW7P/ULkmd5sm1jOhKXbK2A4ETjuAUsagEUECPk4nL2gn7L001lf3OwFIVPWy3Km8g 12jVefJ84QUYNRgzS3JKMoNMnf2FaTcWiFkDZ/nRDbTDt6aerqIMTFELcDbjdiKoZfqza sT/k8JDsrEnMShSzjo9E2ARd8Xhdq/F7DmPMUG8wXJ8MuMod4aLPFrAxcH2A5crHt3A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388722; 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=nX8oDOa08hEj2XiVWxEvQ7dmcYIVi4iL3T2ncMT45iE=; b=OOWQogzd5hqI/I7OkdW1nhoU3MLZjR2+a+gkokEhFTjfrDv8YmRaK2GmsvIJ3TpNp5sm ApVcXsnEs0ALLrqsCBz56Hv40yiRnz4pEM9MW80mvsmU0Jymylm17kVogIeyyAZvuekmK Dv5GwzIxyyFLjQU7rqDspJiGjfgxOosvspA4pe1D7QavO4VXvin7h5+Xs0ZwqhMlvmb8u 7C/Afr0IfpvC6Chjl4DPgsK2TWQHjeiA9Naj1NfF3FJVfXSZHwNAE/6f0b9KKHjnVshtv 6cIz4ikL73DRZBHLw5b+TNYPkem++VcR+JlUtfjEtAUshwIWXHXU72lAOHOYfTclfQw== 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=0uNHASMV; 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 13136606A32D; Fri, 4 Dec 2026 12:52:02 +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=0uNHASMV Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BF251F00935; Fri, 4 Dec 2026 12:52:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388721; bh=nX8oDOa08hEj2XiVWxEvQ7dmcYIVi4iL3T2ncMT45iE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=0uNHASMVpB2MpHCu12NznWaLVclUzKxVOiZTLb3LP9hUlSGVp5h3dy55Uk6i2Wucm ode7TJD3GxRX7hMoRqrf4Qq80H9EUyHbs54vLz7nqQ8JWuXxgYw8dqyJLMniGq1qYC E5tZ2kJmqwoaAb2aomiCzEQnk2wZMKlg0/sTVkjA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhao Li , Johannes Berg , Sasha Levin Subject: [PATCH 6.1 0729/1059] wifi: mac80211: drain link readers before stopping removed links Date: Fri, 4 Dec 2026 19:04:20 +0900 Message-ID: <20261204100702.855159323@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: 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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhao Li [ Upstream commit 745f5d04395dfc4c311f443c7c04ccb00c436984 ] Removing an MLO link can leave work queued on its link container after the container is freed. ieee80211_tear_down_links() stops each link before the RCU grace period. A reader that fetched the link earlier can therefore queue work after ieee80211_link_stop() has canceled it. ieee80211_request_smps() and ieee80211_csa_finish() can both reach this window. Record each removed link while removing its keys and debugfs state. Wait for RCU readers, then stop the recorded links so cancellation includes work queued by those readers. Free the detached keys after the grace period as before. LLM assistance was used to find the bug and review. Fixes: efe9c2bfd1a8 ("wifi: mac80211: isolate driver from inactive links") Cc: stable@vger.kernel.org Signed-off-by: Zhao Li Link: https://patch.msgid.link/20261028141708.5532-1-enderaoelyther@gmail.com Signed-off-by: Johannes Berg [ sashal: Reordered the removed-link stop loop into two passes so the cancel runs after synchronize_rcu(); context differs because the older tree lacks ieee80211_link_debugfs_remove(). ] Signed-off-by: Sasha Levin --- net/mac80211/link.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/mac80211/link.c b/net/mac80211/link.c index abca9d627cfc2..271bbb05bfde9 100644 --- a/net/mac80211/link.c +++ b/net/mac80211/link.c @@ -80,6 +80,7 @@ struct link_container { static void ieee80211_tear_down_links(struct ieee80211_sub_if_data *sdata, struct link_container **links, u16 mask) { + struct ieee80211_link_data *stop[IEEE80211_MLD_MAX_NUM_LINKS] = {}; struct ieee80211_link_data *link; LIST_HEAD(keys); unsigned int link_id; @@ -93,11 +94,16 @@ static void ieee80211_tear_down_links(struct ieee80211_sub_if_data *sdata, if (WARN_ON(!link)) continue; ieee80211_remove_link_keys(link, &keys); - ieee80211_link_stop(link); + stop[link_id] = link; } + /* drain RCU readers before cancelling work they may queue */ synchronize_rcu(); + for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; link_id++) + if (stop[link_id]) + ieee80211_link_stop(stop[link_id]); + ieee80211_free_key_list(sdata->local, &keys); } -- 2.53.0