]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
wifi: rtl8xxxu: Fix use after rcu_read_unlock in rtl8xxxu_bss_info_changed
authorBitterblue Smith <rtl8821cerfe2@gmail.com>
Mon, 21 Nov 2022 20:56:58 +0000 (22:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:18 +0000 (13:32 +0100)
[ Upstream commit 7927afb5e27baac694f585b59c436ba323528dc2 ]

Commit a8b5aef2cca1 ("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: a8b5aef2cca1 ("wifi: rtl8xxxu: gen2: Enable 40 MHz channel width")
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/3c82ad09-7593-3be1-1d2c-e58505fb43cb@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c

index 8d00ce805f1c452b3c981e29edf2052cdb0d44f6..2d908296cf70bc8e0129c2fbbdafcacee814d1ae 100644 (file)
@@ -4654,7 +4654,6 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                        if (sta->deflink.ht_cap.cap &
                            (IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_20))
                                sgi = 1;
-                       rcu_read_unlock();
 
                        highest_rate = fls(ramask) - 1;
                        if (highest_rate < DESC_RATE_MCS0) {
@@ -4679,6 +4678,7 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                                else
                                        rarpt->txrate.bw = RATE_INFO_BW_20;
                        }
+                       rcu_read_unlock();
                        bit_rate = cfg80211_calculate_bitrate(&rarpt->txrate);
                        rarpt->bit_rate = bit_rate;
                        rarpt->desc_rate = highest_rate;