iwlwifi: mvm: Don't call iwl_mvm_sta_from_mac80211() with NULL sta
authorTakashi Iwai <tiwai@suse.de>
Fri, 21 Jan 2022 11:40:24 +0000 (12:40 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:23:32 +0000 (14:23 +0200)
commit21053d7074805489aa2a320001a7ac2668628c68
tree4034ee94604fcbdcd3097425346d3be0eafa3e58
parent2de35ae362f31309927f99ad10858a36d6a1fb0b
iwlwifi: mvm: Don't call iwl_mvm_sta_from_mac80211() with NULL sta

[ 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 <tiwai@suse.de>
Link: https://lore.kernel.org/r/20220121114024.10454-1-tiwai@suse.de
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/intel/iwlwifi/mvm/tx.c