Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2290753pxb; Thu, 11 Feb 2021 08:47:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxAE1fpg+m2Sc52amWVJvbJq0439er1T8pBV1OW2kR1Pu4OUTwVGYYP18MzJtCB5cyd/YjX X-Received: by 2002:a17:906:3c0f:: with SMTP id h15mr8596259ejg.295.1613062043174; Thu, 11 Feb 2021 08:47:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613062043; cv=none; d=google.com; s=arc-20160816; b=nlg9nmpTHGxue82sGalQ3vWWGehYvIU6qEPuAGTgmrxahDfRK5vxCOUNQESLUOuBuq DkicI3QgjhjlIWGMIFDOS1N2Hu3DLIlbvKXDIffbfQcrSFu8Jp41B4A1BwnHH/EIq91v VylJrfL+R4Z2blN2VtHF0lejx+0PZbD7Ldz9N/5F0O36nL6YnCSYTY9BhfenMSP4IUkP OaF1TBjZHDXCCkUKaRMCW1541jRjT4yfmu57LZQZ6bDNfky5hCjA8U4yhLm4uwmxF+eC 2n64KlqXwCJHWPyhm+PtDBbc7HmoVT2S7JLNhpSbBEMRjAyr4C9HjLp4XC0NqHbmJItE gkFQ== 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=D8KgQCR5lJiNWbz5D5J92MTv5oYbjcZfgHZ6cKXYqAI=; b=dAaXap6Oc3i0aHkzQ5L5XXo7FVIC7lhKa47ekm0G4HujBsO2HdWFdXIAJSuzHX5igr /4i1Jes3+qSENpur4MFeducXPLZ8YwQ8vABNKU8KrEkjrfnOQy8S+GfCQXelNr3fYz9d a3mWl7LYBotf9letgoXbXzquv48ocKXjArFekkHfrsvDEFM0ecGuZuvkq8Q/x56u0WKc gSwmqogOhbxJsUUdd/BVl/kgu5HJTupIScsL263tuy0dxu9OEuXRwA0kxV08kUFdRmMd M7ALkrgUdTbs0vbj/2H2zYGcyRX6LB6dETD6bwXMhbeDMmFFk0XYZeQDpTdehThyDNef MNMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kY0pc0r4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dh7si1431069edb.459.2021.02.11.08.46.58; Thu, 11 Feb 2021 08:47:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kY0pc0r4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229952AbhBKQq0 (ORCPT + 99 others); Thu, 11 Feb 2021 11:46:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:57044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231316AbhBKPhB (ORCPT ); Thu, 11 Feb 2021 10:37:01 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 22ADE64EFB; Thu, 11 Feb 2021 15:05:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613055915; bh=L3B6ZScRpTteiAHfJ25ES5UssYuyHCpMGNOYLXRSOmg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kY0pc0r4N9t82Uk9a/bzaA2un99pBJmv3LombJueHfP+SEm8eqLiZPUAO1eFV6UyQ Vhg1XCOvP01k29D9ACpog/QTR7DzuzLzuaYVyzpZma/bhevPkMGzBt4zXXuSw2J8Yg UqllWScZchxbfBZ8Wgpd1f48J4FoOF6chk5HdlLg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gregory Greenman , Luca Coelho , Kalle Valo , Sasha Levin Subject: [PATCH 5.10 35/54] iwlwifi: mvm: invalidate IDs of internal stations at mvm start Date: Thu, 11 Feb 2021 16:02:19 +0100 Message-Id: <20210211150154.409010219@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210211150152.885701259@linuxfoundation.org> References: <20210211150152.885701259@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gregory Greenman [ Upstream commit e223e42aac30bf81f9302c676cdf58cf2bf36950 ] Having sta_id not set for aux_sta and snif_sta can potentially lead to a hard to debug issue in case remove station is called without an add. In this case sta_id 0, an unrelated regular station, will be removed. In fact, we do have a FW assert that occures rarely and from the debug data analysis it looks like sta_id 0 is removed by mistake, though it's hard to pinpoint the exact flow. The WARN_ON in this patch should help to find it. Signed-off-by: Gregory Greenman Signed-off-by: Luca Coelho Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/iwlwifi.20210122144849.5dc6dd9b22d5.I2add1b5ad24d0d0a221de79d439c09f88fcaf15d@changeid Signed-off-by: Sasha Levin --- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 4 ++++ drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index 0d1118f66f0d5..cea8e397fe0f2 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -845,6 +845,10 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, if (!mvm->scan_cmd) goto out_free; + /* invalidate ids to prevent accidental removal of sta_id 0 */ + mvm->aux_sta.sta_id = IWL_MVM_INVALID_STA; + mvm->snif_sta.sta_id = IWL_MVM_INVALID_STA; + /* Set EBS as successful as long as not stated otherwise by the FW. */ mvm->last_ebs_successful = true; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c index 799d8219463cb..a66a5c19474a9 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c @@ -2103,6 +2103,9 @@ int iwl_mvm_rm_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) lockdep_assert_held(&mvm->mutex); + if (WARN_ON_ONCE(mvm->snif_sta.sta_id == IWL_MVM_INVALID_STA)) + return -EINVAL; + iwl_mvm_disable_txq(mvm, NULL, mvm->snif_queue, IWL_MAX_TID_COUNT, 0); ret = iwl_mvm_rm_sta_common(mvm, mvm->snif_sta.sta_id); if (ret) @@ -2117,6 +2120,9 @@ int iwl_mvm_rm_aux_sta(struct iwl_mvm *mvm) lockdep_assert_held(&mvm->mutex); + if (WARN_ON_ONCE(mvm->aux_sta.sta_id == IWL_MVM_INVALID_STA)) + return -EINVAL; + iwl_mvm_disable_txq(mvm, NULL, mvm->aux_queue, IWL_MAX_TID_COUNT, 0); ret = iwl_mvm_rm_sta_common(mvm, mvm->aux_sta.sta_id); if (ret) -- 2.27.0