Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp850872pxb; Wed, 6 Apr 2022 01:56:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgTV2xZNqz/TI5qH4iUZpMCWOVjuNicIqg6g3ox1ktJyiirmvlMiL59urzckAaJEpzmvwC X-Received: by 2002:a17:902:b613:b0:156:7d82:c09b with SMTP id b19-20020a170902b61300b001567d82c09bmr7699876pls.80.1649235379641; Wed, 06 Apr 2022 01:56:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649235379; cv=none; d=google.com; s=arc-20160816; b=Fb0eBdh2G/Gsw8Wb/S9NKfTnfFwncv8UaOKoubzGAEYC624M7IYuog75V1edvQT+/A TlOwrzhNkz7yicSVtQyVLVWQmmVJvdm6/jMiP/PrfFTzQg+b9WwEQ71KKpx47CYDjyp7 a41ojJuBAM0FKr9gilW6dUfVrnpVIfNjhYNMRy3fn9gKMGIZWOLMCyD2eKa1jr3McXEQ Y7FrrMfrIL3EwO0bOwtVDUU+K33w43u/GkFPB//fSCNhYluCyibBs4LB4IAUPqqQnlIs kk4yOM/l5Q6O3J8rHHnUf9rSFuF7sjsfWVvGWHN1Bm7fg4vlkXAueKWOAAGOrrafp9JI AXjw== 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=bwsw6uDT4eGex8wB1+DhHZI/uPbsr/SaPGgaa9X0U2Y=; b=z0HolR2NeJlVfD16ROZOojZayWyRkWHNP5IAbsvNXbYBFvbGE+fHb9qX7xqh3NmVnn X8CJOgethcAXpmb2F6DoyMT6/8JFr1nbfcKaG4fMtOEPZ8/9xepMTvw66CWEJJ/GJVsj MQN20fHQOOcr+ptUcjXYVLXuqomF9fBHosbAa4ej8yH3spTNynlI6Tv4NnWh3N9ogcO4 froLRbcwf1bC6LMqTzWFRn9ZdzH1hB8g192dWnwnX7SkV/JNHdzNi3DTKsJ1DoFG2rqc RLXm0dpRsYp1avKZy420wmguw4VsMoPpR23DCHMpCGRru/bzUnLYoHr652KNXm/X20cj moSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CIH4+l+Q; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id b15-20020a056a000a8f00b004fa3a8dff9csi16291255pfl.83.2022.04.06.01.56.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 01:56:19 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CIH4+l+Q; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9D40858D1B7; Wed, 6 Apr 2022 01:48:59 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574816AbiDEXBQ (ORCPT + 99 others); Tue, 5 Apr 2022 19:01:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349057AbiDEJtD (ORCPT ); Tue, 5 Apr 2022 05:49:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20050A94EC; Tue, 5 Apr 2022 02:39:27 -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 ams.source.kernel.org (Postfix) with ESMTPS id C721AB818F3; Tue, 5 Apr 2022 09:39:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12FF6C385A2; Tue, 5 Apr 2022 09:39:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151564; bh=WuRlOwtrRvuEhnjGzamlA5fZhPSxTgvN2dXTvL/ROmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CIH4+l+QUQbQFXC8Ud9+pKBnKzIYvfPrEKuVxbd9cEsgrMHUghT6k0rZ15WCTvk+I Yr2tph9yxgNBOI0gF7Nz+8HPonbFaBMaAjqnC4H/jFWPmIreN4PkqagREc64WHbCYK xgrlMb33oQ4jB1opz7a+4wDuqx6BlXWeRBtJn61g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Luca Coelho , Sasha Levin Subject: [PATCH 5.15 462/913] iwlwifi: mvm: Dont call iwl_mvm_sta_from_mac80211() with NULL sta Date: Tue, 5 Apr 2022 09:25:24 +0200 Message-Id: <20220405070353.697190655@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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: Takashi Iwai [ Upstream commit 30d17c12b0895e15ce22ebc1f52a4ff02df6dbc6 ] The recent fix for NULL sta in iwl_mvm_get_tx_rate() still has a call of iwl_mvm_sta_from_mac80211() that may be called with NULL sta. Although this practically only points to the address and the actual access doesn't happen due to the conditional evaluation at a later point, it looks a bit flaky. This patch drops the temporary variable above and evaluates iwm_mvm_sta_from_mac80211() directly for avoiding confusions. Fixes: d599f714b73e ("iwlwifi: mvm: don't crash on invalid rate w/o STA") Signed-off-by: Takashi Iwai Link: https://lore.kernel.org/r/20220121114024.10454-1-tiwai@suse.de Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin --- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c index 06fbd9ab37df..b5368cb57ca8 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c @@ -271,15 +271,14 @@ static u32 iwl_mvm_get_tx_rate(struct iwl_mvm *mvm, /* info->control is only relevant for non HW rate control */ if (!ieee80211_hw_check(mvm->hw, HAS_RATE_CONTROL)) { - struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); - /* HT rate doesn't make sense for a non data frame */ WARN_ONCE(info->control.rates[0].flags & IEEE80211_TX_RC_MCS && !ieee80211_is_data(fc), "Got a HT rate (flags:0x%x/mcs:%d/fc:0x%x/state:%d) for a non data frame\n", info->control.rates[0].flags, info->control.rates[0].idx, - le16_to_cpu(fc), sta ? mvmsta->sta_state : -1); + le16_to_cpu(fc), + sta ? iwl_mvm_sta_from_mac80211(sta)->sta_state : -1); rate_idx = info->control.rates[0].idx; } -- 2.34.1