]> git.proxmox.com Git - mirror_ubuntu-kernels.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)
committerKalle Valo <kvalo@kernel.org>
Mon, 28 Nov 2022 13:57:07 +0000 (15:57 +0200)
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
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c

index e8fcd531c4375f3de9125ab2f98e510ced3deb93..28f136064297cb424c5a3d1a8df7b9db8ff961bc 100644 (file)
@@ -4645,7 +4645,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) {
@@ -4670,6 +4669,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;