Commit 7927afb5 authored by Bitterblue Smith's avatar Bitterblue Smith Committed by Kalle Valo

wifi: rtl8xxxu: Fix use after rcu_read_unlock in rtl8xxxu_bss_info_changed

Commit a8b5aef2 ("wifi: rtl8xxxu: gen2: Enable 40 MHz channel width")
introduced a line where the pointer returned by ieee80211_find_sta() is
used after rcu_read_unlock().

Move rcu_read_unlock() a bit lower to fix this.

Fixes: a8b5aef2 ("wifi: rtl8xxxu: gen2: Enable 40 MHz channel width")
Signed-off-by: default avatarBitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/3c82ad09-7593-3be1-1d2c-e58505fb43cb@gmail.com
parent 895b3b06
...@@ -4645,7 +4645,6 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -4645,7 +4645,6 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if (sta->deflink.ht_cap.cap & if (sta->deflink.ht_cap.cap &
(IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_20)) (IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_20))
sgi = 1; sgi = 1;
rcu_read_unlock();
highest_rate = fls(ramask) - 1; highest_rate = fls(ramask) - 1;
if (highest_rate < DESC_RATE_MCS0) { if (highest_rate < DESC_RATE_MCS0) {
...@@ -4670,6 +4669,7 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -4670,6 +4669,7 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
else else
rarpt->txrate.bw = RATE_INFO_BW_20; rarpt->txrate.bw = RATE_INFO_BW_20;
} }
rcu_read_unlock();
bit_rate = cfg80211_calculate_bitrate(&rarpt->txrate); bit_rate = cfg80211_calculate_bitrate(&rarpt->txrate);
rarpt->bit_rate = bit_rate; rarpt->bit_rate = bit_rate;
rarpt->desc_rate = highest_rate; rarpt->desc_rate = highest_rate;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment