* [PATCH v1 1/2] wifi: mt76: init chan pointer to aovid unexpected behavior
@ 2026-12-02 8:18 Anthony Liu
2026-12-02 8:18 ` [PATCH v1 2/2] wifi: mt76: add boundary check to array accesses Anthony Liu
0 siblings, 1 reply; 2+ messages in thread
From: Anthony Liu @ 2026-12-02 8:18 UTC (permalink / raw)
To: anthony.liu
Cc: Emery.Hsin, Jb.Tsai, Leon.Yen, Litien.Chang, Quan.Zhou, Ryder.Lee,
Sean.Wang, kun.wu, linux-wireless, lorenzo, nbd
In mt76_remain_on_channel(), defensively initialize chandef.chan with
the requested channel instead of using an empty initializer.
Signed-off-by: Anthony Liu <anthony.liu@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/channel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/channel.c b/drivers/net/wireless/mediatek/mt76/channel.c
index b3c17f76b101..0db1e5456c30 100644
--- a/drivers/net/wireless/mediatek/mt76/channel.c
+++ b/drivers/net/wireless/mediatek/mt76/channel.c
@@ -449,7 +449,7 @@ int mt76_remain_on_channel(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_channel *chan, int duration,
enum ieee80211_roc_type type)
{
- struct cfg80211_chan_def chandef = {};
+ struct cfg80211_chan_def chandef = { .chan = chan };
struct mt76_phy *phy = hw->priv;
struct mt76_dev *dev = phy->dev;
struct mt76_vif_link *mlink;
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH v1 2/2] wifi: mt76: add boundary check to array accesses
2026-12-02 8:18 [PATCH v1 1/2] wifi: mt76: init chan pointer to aovid unexpected behavior Anthony Liu
@ 2026-12-02 8:18 ` Anthony Liu
0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liu @ 2026-12-02 8:18 UTC (permalink / raw)
To: anthony.liu
Cc: Emery.Hsin, Jb.Tsai, Leon.Yen, Litien.Chang, Quan.Zhou, Ryder.Lee,
Sean.Wang, kun.wu, linux-wireless, lorenzo, nbd
Add array boundary check to functions accessing Tx qeueus, MCU
queues, and ACPI data tables.
Signed-off-by: Anthony Liu <anthony.liu@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt76.h | 6 ++++++
drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c | 7 +++++++
2 files changed, 13 insertions(+)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index 237057caf35e..f9c38a8c0722 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -1397,6 +1397,9 @@ static inline int mt76_init_tx_queue(struct mt76_phy *phy, int qid, int idx,
{
struct mt76_queue *q;
+ if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
+ return -EINVAL;
+
q = mt76_init_queue(phy->dev, qid, idx, n_desc, ring_base, wed, flags);
if (IS_ERR(q))
return PTR_ERR(q);
@@ -1411,6 +1414,9 @@ static inline int mt76_init_mcu_queue(struct mt76_dev *dev, int qid, int idx,
{
struct mt76_queue *q;
+ if (qid < 0 || qid >= ARRAY_SIZE(dev->q_mcu))
+ return -EINVAL;
+
q = mt76_init_queue(dev, qid, idx, n_desc, ring_base, NULL, 0);
if (IS_ERR(q))
return PTR_ERR(q);
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c b/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c
index d8268ec56f98..459d5c86c095 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c
@@ -432,6 +432,9 @@ mt792x_acpi_get_mtcl_map_v3(int row, int column, struct mt792x_asar_cl_v3 *cl)
u32 config = 0;
u8 mode_be = 0;
+ if (row < 0 || row >= ARRAY_SIZE(cl->clbe))
+ return 0;
+
mode_be = (cl->mode_be > 0x02) ? 0 : cl->mode_be;
if (cl->version > 2 && cl->clbe[row] & BIT(column))
@@ -446,6 +449,10 @@ mt792x_acpi_get_mtcl_map(int row, int column, struct mt792x_asar_cl *cl)
u32 config = 0;
u8 mode_6g, mode_5g9;
+ if (row < 0 || row >= ARRAY_SIZE(cl->cl6g) ||
+ row >= ARRAY_SIZE(cl->cl5g9))
+ return 0;
+
mode_6g = (cl->mode_6g > 0x02) ? 0 : cl->mode_6g;
mode_5g9 = (cl->mode_5g9 > 0x01) ? 0 : cl->mode_5g9;
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-02 8:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 8:18 [PATCH v1 1/2] wifi: mt76: init chan pointer to aovid unexpected behavior Anthony Liu
2026-12-02 8:18 ` [PATCH v1 2/2] wifi: mt76: add boundary check to array accesses Anthony Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox