mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 10:20:17 -04:00
wifi: rtw88: prevent scan abort with other VIFs
Only abort scan with current scanning VIF. If we have more than one interface, we could call rtw_hw_scan_abort() with the wrong VIF as input. This avoids potential null pointer being accessed when actually the other VIF is scanning. Signed-off-by: Po-Hao Huang <phhuang@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230414121312.17954-1-pkshih@realtek.com
This commit is contained in:
@@ -2163,8 +2163,10 @@ int rtw_hw_scan_offload(struct rtw_dev *rtwdev, struct ieee80211_vif *vif,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void rtw_hw_scan_abort(struct rtw_dev *rtwdev, struct ieee80211_vif *vif)
|
||||
void rtw_hw_scan_abort(struct rtw_dev *rtwdev)
|
||||
{
|
||||
struct ieee80211_vif *vif = rtwdev->scan_info.scanning_vif;
|
||||
|
||||
if (!rtw_fw_feature_check(&rtwdev->fw, FW_FEATURE_SCAN_OFFLOAD))
|
||||
return;
|
||||
|
||||
|
||||
@@ -868,5 +868,5 @@ int rtw_hw_scan_offload(struct rtw_dev *rtwdev, struct ieee80211_vif *vif,
|
||||
bool enable);
|
||||
void rtw_hw_scan_status_report(struct rtw_dev *rtwdev, struct sk_buff *skb);
|
||||
void rtw_hw_scan_chan_switch(struct rtw_dev *rtwdev, struct sk_buff *skb);
|
||||
void rtw_hw_scan_abort(struct rtw_dev *rtwdev, struct ieee80211_vif *vif);
|
||||
void rtw_hw_scan_abort(struct rtw_dev *rtwdev);
|
||||
#endif
|
||||
|
||||
@@ -393,7 +393,8 @@ static void rtw_ops_bss_info_changed(struct ieee80211_hw *hw,
|
||||
* when disconnected by peer
|
||||
*/
|
||||
if (test_bit(RTW_FLAG_SCANNING, rtwdev->flags))
|
||||
rtw_hw_scan_abort(rtwdev, vif);
|
||||
rtw_hw_scan_abort(rtwdev);
|
||||
|
||||
}
|
||||
|
||||
config |= PORT_SET_NET_TYPE;
|
||||
@@ -870,7 +871,7 @@ static int rtw_ops_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
rtw_hw_scan_start(rtwdev, vif, req);
|
||||
ret = rtw_hw_scan_offload(rtwdev, vif, true);
|
||||
if (ret) {
|
||||
rtw_hw_scan_abort(rtwdev, vif);
|
||||
rtw_hw_scan_abort(rtwdev);
|
||||
rtw_err(rtwdev, "HW scan failed with status: %d\n", ret);
|
||||
}
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
@@ -890,7 +891,7 @@ static void rtw_ops_cancel_hw_scan(struct ieee80211_hw *hw,
|
||||
return;
|
||||
|
||||
mutex_lock(&rtwdev->mutex);
|
||||
rtw_hw_scan_abort(rtwdev, vif);
|
||||
rtw_hw_scan_abort(rtwdev);
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user