From patchwork Fri Mar 18 22:18:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryder Lee X-Patchwork-Id: 552984 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACF61C433EF for ; Fri, 18 Mar 2022 22:18:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241274AbiCRWTq (ORCPT ); Fri, 18 Mar 2022 18:19:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233444AbiCRWTn (ORCPT ); Fri, 18 Mar 2022 18:19:43 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87BEB183836 for ; Fri, 18 Mar 2022 15:18:18 -0700 (PDT) X-UUID: d8c01a71268f43efa11bdd66a23fe154-20220319 X-UUID: d8c01a71268f43efa11bdd66a23fe154-20220319 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1027730250; Sat, 19 Mar 2022 06:18:12 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 19 Mar 2022 06:18:11 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 19 Mar 2022 06:18:11 +0800 From: Ryder Lee To: Johannes Berg CC: , , Ryder Lee Subject: [PATCH] mac80211: adjust the replace_state of ieee80211_find_chanctx() Date: Sat, 19 Mar 2022 06:18:10 +0800 Message-ID: <40aabb3e10302f1d7da92b7a4eb46577d5ed8e05.1647641256.git.ryder.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org We observe that the condition of chanctx could not be back to IEEE80211_CHANCTX_REPLACE_NONE occasionally while STA connection. In this case the state could be IEEE80211_CHANCTX_REPLACE_OTHER, which fails the check and then creates another chanctx that leads to the next round of chan_switch failure in cfg80211_check_combinations(). So, modify state to just rule out IEEE80211_CHANCTX_WILL_BE_REPLACED. Signed-off-by: Ryder Lee --- net/mac80211/chan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index e26d42de14ec..604095ff7a5b 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -477,7 +477,7 @@ ieee80211_find_chanctx(struct ieee80211_local *local, list_for_each_entry(ctx, &local->chanctx_list, list) { const struct cfg80211_chan_def *compat; - if (ctx->replace_state != IEEE80211_CHANCTX_REPLACE_NONE) + if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) continue; if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE)