linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] check sta_rates pointer in sta_rate_tbl_update callback
@ 2022-01-22 14:58 Lorenzo Bianconi
  2022-01-22 14:58 ` [PATCH 1/2] mt76: mt7603: check sta_rates pointer in mt7603_sta_rate_tbl_update Lorenzo Bianconi
  2022-01-22 14:58 ` [PATCH 2/2] mt76: mt7615: check sta_rates pointer in mt7615_sta_rate_tbl_update Lorenzo Bianconi
  0 siblings, 2 replies; 3+ messages in thread
From: Lorenzo Bianconi @ 2022-01-22 14:58 UTC (permalink / raw)
  To: nbd; +Cc: lorenzo.bianconi, linux-wireless, ryder.lee

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(+)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] mt76: mt7603: check sta_rates pointer in mt7603_sta_rate_tbl_update
  2022-01-22 14:58 [PATCH 0/2] check sta_rates pointer in sta_rate_tbl_update callback Lorenzo Bianconi
@ 2022-01-22 14:58 ` Lorenzo Bianconi
  2022-01-22 14:58 ` [PATCH 2/2] mt76: mt7615: check sta_rates pointer in mt7615_sta_rate_tbl_update Lorenzo Bianconi
  1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Bianconi @ 2022-01-22 14:58 UTC (permalink / raw)
  To: nbd; +Cc: lorenzo.bianconi, linux-wireless, ryder.lee

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 <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt7603/main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/main.c b/drivers/net/wireless/mediatek/mt76/mt7603/main.c
index 2b546bc05d82..83c5eec5b163 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/main.c
@@ -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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] mt76: mt7615: check sta_rates pointer in mt7615_sta_rate_tbl_update
  2022-01-22 14:58 [PATCH 0/2] check sta_rates pointer in sta_rate_tbl_update callback Lorenzo Bianconi
  2022-01-22 14:58 ` [PATCH 1/2] mt76: mt7603: check sta_rates pointer in mt7603_sta_rate_tbl_update Lorenzo Bianconi
@ 2022-01-22 14:58 ` Lorenzo Bianconi
  1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Bianconi @ 2022-01-22 14:58 UTC (permalink / raw)
  To: nbd; +Cc: lorenzo.bianconi, linux-wireless, ryder.lee

Check 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 <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt7615/main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
index 9f7ac78f1222..fca38f0e1a27 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
@@ -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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-22 14:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-22 14:58 [PATCH 0/2] check sta_rates pointer in sta_rate_tbl_update callback Lorenzo Bianconi
2022-01-22 14:58 ` [PATCH 1/2] mt76: mt7603: check sta_rates pointer in mt7603_sta_rate_tbl_update Lorenzo Bianconi
2022-01-22 14:58 ` [PATCH 2/2] mt76: mt7615: check sta_rates pointer in mt7615_sta_rate_tbl_update Lorenzo Bianconi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).