blob: 089bba00b92cde3426398460445672f819ac18ac [file] [log] [blame]
From e70e972add40eb5db6463cf156ae19b8dc9bc67c Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Thu, 5 Sep 2024 15:46:10 +0800
Subject: [PATCH 193/223] mtk: mt76: mt7996: fix potential crash issue in
mt7996_tx_prepare_skb()
This commit aims to fix potential NULL pointer issue of sta, especially
when the sta keeps conencting and disconneting.
Change-Id: I4407e2b39dd75f161c9cf4d93c652949ca9ddcf6
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
mt7996/mac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mt7996/mac.c b/mt7996/mac.c
index 5d40b8f1..b6980584 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -947,7 +947,7 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
}
msta = sta ? (struct mt7996_sta *)sta->drv_priv : &mvif->sta;
- if (ieee80211_is_data_qos(hdr->frame_control) && sta->mlo) {
+ if ((is_8023 || ieee80211_is_data_qos(hdr->frame_control)) && sta && sta->mlo) {
if (unlikely(tx_info->skb->protocol == cpu_to_be16(ETH_P_PAE))) {
link_id = msta->pri_link;
} else {
--
2.45.2