wifi: rtw89: fix null vif pointer when get management frame date rate
Ping-Ke Shih
maintainerPATCH 1/2 wifi: rtw89: fix null vif pointer when get management frame date rate
From: Kuan-Chung Chen <[email protected]>
When transmitting a packet that gets from ieee80211_nullfunc_get(), the vif in tx_info->control was no assigned, which will cause dereferencing a null pointer.
--- drivers/net/wireless/realtek/rtw89/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/core.c +2 -1
@@ -498,7 +498,8 @@ static u16 rtw89_core_get_mgmt_rate(struct rtw89_dev *rtwdev,const struct rtw89_chan *chan =rtw89_chan_get (rtwdev,RTW89_SUB_ENTITY_0 );u16 lowest_rate; -if (tx_info->flags &IEEE80211_TX_CTL_NO_CCK_RATE || vif->p2p) +if (tx_info->flags &IEEE80211_TX_CTL_NO_CCK_RATE || + (vif && vif->p2p)) lowest_rate =RTW89_HW_RATE_OFDM6 ;else if (chan->band_type ==RTW89_BAND_2G ) lowest_rate =RTW89_HW_RATE_CCK1 ;
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 2/2 wifi: rtw89: set the correct mac_id for management frames
From: Kuan-Chung Chen <[email protected]>
The mac_id of management frames should follow rtwvif->mac_id or rtwsta->mac_id. Add this patch to set the correct mac_id and prevent unexpected behavior.
--- drivers/net/wireless/realtek/rtw89/core.c | 31 ++++++++++++----------- 1 file changed, 16 insertions(+), 15 deletions(-)
drivers/net/wireless/realtek/rtw89/core.c +16 -15
@@ -512,6 +512,21 @@ static u16 rtw89_core_get_mgmt_rate(struct rtw89_dev *rtwdev,return __ffs (vif->bss_conf.basic_rates) + lowest_rate; } +static u8 rtw89_core_tx_get_mac_id (struct rtw89_dev *rtwdev, +struct rtw89_core_tx_request *tx_req) +{ +struct ieee80211_vif *vif = tx_req->vif; +struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv; +struct ieee80211_sta *sta = tx_req->sta; +struct rtw89_sta *rtwsta; + +if (!sta) +return rtwvif->mac_id; + + rtwsta = (struct rtw89_sta *)sta->drv_priv; +return rtwsta->mac_id; +} +static void rtw89_core_tx_update_mgmt_info (struct rtw89_dev *rtwdev,struct rtw89_core_tx_request *tx_req)
@@ -528,6 +543,7 @@ rtw89_core_tx_update_mgmt_info(struct rtw89_dev *rtwdev, desc_info->qsel = qsel; desc_info->ch_dma = ch_dma; desc_info->port = desc_info->hiq ? rtwvif->port :0 ; + desc_info->mac_id =rtw89_core_tx_get_mac_id (rtwdev, tx_req); desc_info->hw_ssn_sel =RTW89_MGMT_HW_SSN_SEL ; desc_info->hw_seq_mode =RTW89_MGMT_HW_SEQ_MODE ;
@@ -670,21 +686,6 @@ rtw89_core_tx_update_he_qos_htc(struct rtw89_dev *rtwdev, desc_info->bk = true; } -static u8 rtw89_core_tx_get_mac_id (struct rtw89_dev *rtwdev, -struct rtw89_core_tx_request *tx_req) -{ -struct ieee80211_vif *vif = tx_req->vif; -struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv; -struct ieee80211_sta *sta = tx_req->sta; -struct rtw89_sta *rtwsta; - -if (!sta) -return rtwvif->mac_id; - - rtwsta = (struct rtw89_sta *)sta->drv_priv; -return rtwsta->mac_id; -} -static void rtw89_core_tx_update_data_info (struct rtw89_dev *rtwdev,struct rtw89_core_tx_request *tx_req)
Signature · 1 line
2.25.1
Quoted 8 lines · Ping-Ke Shih
From: Kuan-Chung Chen <[email protected]>
When transmitting a packet that gets from
ieee80211_nullfunc_get(), the vif intx_info->controlwas no assigned, which will cause dereferencing a null pointer.Signed-off-by Kuan-Chung Chen <[email protected]>Signed-off-by Ping-Ke Shih <[email protected]>
2 patches applied to wireless-next.git, thanks.
95dafeabe477 wifi: rtw89: fix null vif pointer when get management frame date rate 877287f971b1 wifi: rtw89: set the correct mac_id for management frames
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches