Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp810944pxb; Tue, 12 Apr 2022 14:06:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+fapWV6tsgw3DoXMk0RoMmU664INNGbw7CQMbimKUR+VD0Fg5jQ5N4Xf+MwBXDoHIE7qZ X-Received: by 2002:a63:4d64:0:b0:39d:5e6e:242d with SMTP id n36-20020a634d64000000b0039d5e6e242dmr9665405pgl.32.1649797561948; Tue, 12 Apr 2022 14:06:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649797561; cv=none; d=google.com; s=arc-20160816; b=HMckq4IgnHYQKXNnbugn1D9c7uvkkIAApHamp6dAtSkjY5ryoEDn3GzFINZ7L8/JaZ AsfdabGLPQjC+mDMxzQh/FmVBlOVBKOo0kOzIZsSOq3A8zh8EHuKfbJmFxkCEcMqsIN1 LwLwFSygP2KYWBgGUpnleJXyR6Y5Bn/wQZUviVSET4WDoUoqBZgb1NfT0gBLw6thkPVy +F+jJMKqDp5KGMtsG92Nb+2/YJukVr0SFEz0aJj26W7dyN0RofZIDe+8v268HCKkB9a4 d5c9Ks1eJ+HXVE6cBtbsr2pHG3B1Do8GVPcNdJHQAFsTe4rLLLLFtzlNnoOPB69a2aZe 77jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ej7+tuUGFONwVyCCV1rx3BHxHXFQVeQ15ixIAxExilY=; b=vkPQy4Ssn1KTYEibdmwg2JplDoke5TaKGlSak5ZkslXhdL8x9DtzCnokg15ktoF9YX +p0KNOAU/xN3+liTDC051OzJKu0jJiga36IRQzmEjONgOeyVMbipdzSHCrstcZR5PkMH 2QgAVVlP8DxG5FaWePkA7tN/XgBFd4A199hDLTvLq0bp7PYZBWHeGre/MpUV7720KGJU q8J3iDhJXblGn+V76xxwsrsV8qTAdaSituEAmBsinGtPGb/FJh74dqWQFOuSAwju9EdJ 1dWg/ORJ/xUr47c9URB2H9GPEaltaColQEiDHvxBIuKzF5pa0mNyIiAzyP7uAtKVRlsC F63w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="2XoqtE/g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q23-20020a170902bd9700b001582df31a76si10791259pls.606.2022.04.12.14.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 14:06:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="2XoqtE/g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 54D5790270; Tue, 12 Apr 2022 13:24:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358276AbiDLHlR (ORCPT + 99 others); Tue, 12 Apr 2022 03:41:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353160AbiDLHOx (ORCPT ); Tue, 12 Apr 2022 03:14:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92B9C37A3F; Mon, 11 Apr 2022 23:56:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3227561572; Tue, 12 Apr 2022 06:56:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E0EBC385A1; Tue, 12 Apr 2022 06:56:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649746598; bh=4C9l3ozTCA7bF8Ub+SzXQVBfPrIj+YQioOgIA03OWB0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2XoqtE/grAi92lWry2QkFjFZWbMKmWw9ByWTZyHQMKcRb1YbBGaU+cYTWqw2g8ctZ jWauMuSPG5qurx+G+bQhxEwIRey1uB6xF5SMdczP7vWYJmy4zuoJlgRry6x34fxXgz n58lB3DokZc8lqjITebu2rlQQi32XMBohVMQx7w4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miri Korenblit , Luca Coelho , Sasha Levin Subject: [PATCH 5.16 062/285] iwlwifi: mvm: move only to an enabled channel Date: Tue, 12 Apr 2022 08:28:39 +0200 Message-Id: <20220412062945.459531152@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220412062943.670770901@linuxfoundation.org> References: <20220412062943.670770901@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miri Korenblit [ Upstream commit e04135c07755d001b5cde61048c69a7cc84bb94b ] During disassociation we're decreasing the phy's ref count. If the ref count becomes 0, we're configuring the phy ctxt to the default channel (the lowest channel which the device can operate on). Currently we're not checking whether the the default channel is enabled or not. Fix it by configuring the phy ctxt to the lowest channel which is enabled. Signed-off-by: Miri Korenblit Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20220210181930.03f281b6a6bc.I5b63d43ec41996d599e6f37ec3f32e878b3e405e@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin --- .../net/wireless/intel/iwlwifi/mvm/phy-ctxt.c | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c index 035336a9e755..6d82725cb87d 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* - * Copyright (C) 2012-2014, 2018-2021 Intel Corporation + * Copyright (C) 2012-2014, 2018-2022 Intel Corporation * Copyright (C) 2013-2014 Intel Mobile Communications GmbH * Copyright (C) 2017 Intel Deutschland GmbH */ @@ -295,18 +295,31 @@ void iwl_mvm_phy_ctxt_unref(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt) * otherwise we might not be able to reuse this phy. */ if (ctxt->ref == 0) { - struct ieee80211_channel *chan; + struct ieee80211_channel *chan = NULL; struct cfg80211_chan_def chandef; - struct ieee80211_supported_band *sband = NULL; - enum nl80211_band band = NL80211_BAND_2GHZ; + struct ieee80211_supported_band *sband; + enum nl80211_band band; + int channel; - while (!sband && band < NUM_NL80211_BANDS) - sband = mvm->hw->wiphy->bands[band++]; + for (band = NL80211_BAND_2GHZ; band < NUM_NL80211_BANDS; band++) { + sband = mvm->hw->wiphy->bands[band]; - if (WARN_ON(!sband)) - return; + if (!sband) + continue; + + for (channel = 0; channel < sband->n_channels; channel++) + if (!(sband->channels[channel].flags & + IEEE80211_CHAN_DISABLED)) { + chan = &sband->channels[channel]; + break; + } - chan = &sband->channels[0]; + if (chan) + break; + } + + if (WARN_ON(!chan)) + return; cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT); iwl_mvm_phy_ctxt_changed(mvm, ctxt, &chandef, 1, 1); -- 2.35.1