diff mbox series

[1/2] wifi: rtw89: fix null vif pointer when get management frame date rate

Message ID 20230106121517.19841-1-pkshih@realtek.com
State New
Headers show
Series [1/2] wifi: rtw89: fix null vif pointer when get management frame date rate | expand

Commit Message

Ping-Ke Shih Jan. 6, 2023, 12:15 p.m. UTC
From: Kuan-Chung Chen <damon.chen@realtek.com>

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.

Signed-off-by: Kuan-Chung Chen <damon.chen@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw89/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Kalle Valo Jan. 16, 2023, 1:37 p.m. UTC | #1
Ping-Ke Shih <pkshih@realtek.com> wrote:

> From: Kuan-Chung Chen <damon.chen@realtek.com>
> 
> 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.
> 
> Signed-off-by: Kuan-Chung Chen <damon.chen@realtek.com>
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>

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
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
index adc961752a291..f06840634e113 100644
--- a/drivers/net/wireless/realtek/rtw89/core.c
+++ b/drivers/net/wireless/realtek/rtw89/core.c
@@ -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;