check sta_rates pointer in sta_rate_tbl_update callback
Subsystems (2)
Lorenzo Bianconi
maintainercover check sta_rates pointer in sta_rate_tbl_update callback
Fix potential NULL pointer dereference issue.
Lorenzo Bianconi (2):
mt76: mt7603: check sta_rates pointer in mt7603_sta_rate_tbl_update
mt76: mt7615: check sta_rates pointer in mt7615_sta_rate_tbl_update
drivers/net/wireless/mediatek/mt76/mt7603/main.c | 3 +++ drivers/net/wireless/mediatek/mt76/mt7615/main.c | 3 +++ 2 files changed, 6 insertions(+)
Signature · 1 line
2.34.1
Lorenzo Bianconi
maintainerPATCH 1/2 mt76: mt7603: check sta_rates pointer in mt7603_sta_rate_tbl_update
Check sta_rates pointer value in mt7603_sta_rate_tbl_update routine since minstrel_ht_update_rates can fail allocating rates array.
Fixes c8846e1015022 ("mt76: add driver for MT7603E and MT7628/7688")
Signed-off-by Lorenzo Bianconi <[email protected]>
--- drivers/net/wireless/mediatek/mt76/mt7603/main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7603/main.c +3 -0
@@ -641,6 +641,9 @@ mt7603_sta_rate_tbl_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif,struct ieee80211_sta_rates *sta_rates =rcu_dereference (sta->rates);int i; +if (!sta_rates) +return ; +spin_lock_bh (&dev->mt76.lock);for (i =0 ; i <ARRAY_SIZE (msta->rates); i++) { msta->rates[i].idx = sta_rates->rate[i].idx;
Signature · 1 line
2.34.1
Lorenzo Bianconi
maintainerPATCH 2/2 mt76: mt7615: check sta_rates pointer in mt7615_sta_rate_tbl_update
In reply to Lorenzo BianconiCheck sta_rates pointer value in mt7615_sta_rate_tbl_update routine since minstrel_ht_update_rates can fail allocating rates array.
Fixes 04b8e65922f63 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
Signed-off-by Lorenzo Bianconi <[email protected]>
--- drivers/net/wireless/mediatek/mt76/mt7615/main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7615/main.c +3 -0
@@ -689,6 +689,9 @@ static void mt7615_sta_rate_tbl_update(struct ieee80211_hw *hw,struct ieee80211_sta_rates *sta_rates =rcu_dereference (sta->rates);int i; +if (!sta_rates) +return ; +spin_lock_bh (&dev->mt76.lock);for (i =0 ; i <ARRAY_SIZE (msta->rates); i++) { msta->rates[i].idx = sta_rates->rate[i].idx;
Signature · 1 line
2.34.1