Skip to content

Commit 4804c8a

Browse files
nbd168edoardocanepa
authored andcommitted
wifi: mt76: mt7996: fix null pointer deref in mt7996_conf_tx()
BugLink: https://bugs.launchpad.net/bugs/2139960 [ Upstream commit 79277f8 ] If a link does not have an assigned channel yet, mt7996_vif_link returns NULL. We still need to store the updated queue settings in that case, and apply them later. Move the location of the queue params to within struct mt7996_vif_link. Fixes: c0df2f0 ("wifi: mt76: mt7996: prepare mt7996_mcu_set_tx for MLO support") Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://patch.msgid.link/20250929111723.52486-1-nbd@nbd.name Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Sasha Levin <sashal@kernel.org> CVE-2025-68738 Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com> Signed-off-by: Edoardo Canepa <edoardo.canepa@canonical.com>
1 parent c19795a commit 4804c8a

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

drivers/net/wireless/mediatek/mt76/mt7996/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,8 @@ mt7996_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
650650
unsigned int link_id, u16 queue,
651651
const struct ieee80211_tx_queue_params *params)
652652
{
653-
struct mt7996_dev *dev = mt7996_hw_dev(hw);
654-
struct mt7996_vif_link *mlink = mt7996_vif_link(dev, vif, link_id);
653+
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
654+
struct mt7996_vif_link_info *link_info = &mvif->link_info[link_id];
655655
static const u8 mq_to_aci[] = {
656656
[IEEE80211_AC_VO] = 3,
657657
[IEEE80211_AC_VI] = 2,
@@ -660,7 +660,7 @@ mt7996_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
660660
};
661661

662662
/* firmware uses access class index */
663-
mlink->queue_params[mq_to_aci[queue]] = *params;
663+
link_info->queue_params[mq_to_aci[queue]] = *params;
664664
/* no need to update right away, we'll get BSS_CHANGED_QOS */
665665

666666
return 0;

drivers/net/wireless/mediatek/mt76/mt7996/mcu.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3438,6 +3438,9 @@ int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct ieee80211_vif *vif,
34383438
#define WMM_PARAM_SET (WMM_AIFS_SET | WMM_CW_MIN_SET | \
34393439
WMM_CW_MAX_SET | WMM_TXOP_SET)
34403440
struct mt7996_vif_link *link = mt7996_vif_conf_link(dev, vif, link_conf);
3441+
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
3442+
unsigned int link_id = link_conf->link_id;
3443+
struct mt7996_vif_link_info *link_info = &mvif->link_info[link_id];
34413444
struct {
34423445
u8 bss_idx;
34433446
u8 __rsv[3];
@@ -3455,7 +3458,7 @@ int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct ieee80211_vif *vif,
34553458
skb_put_data(skb, &hdr, sizeof(hdr));
34563459

34573460
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
3458-
struct ieee80211_tx_queue_params *q = &link->queue_params[ac];
3461+
struct ieee80211_tx_queue_params *q = &link_info->queue_params[ac];
34593462
struct edca *e;
34603463
struct tlv *tlv;
34613464

drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,21 @@ struct mt7996_vif_link {
246246
struct mt7996_sta_link msta_link;
247247
struct mt7996_phy *phy;
248248

249-
struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
250249
struct cfg80211_bitrate_mask bitrate_mask;
251250

252251
u8 mld_idx;
253252
};
254253

254+
struct mt7996_vif_link_info {
255+
struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
256+
};
257+
255258
struct mt7996_vif {
256259
struct mt7996_vif_link deflink; /* must be first */
257260
struct mt76_vif_data mt76;
258261

262+
struct mt7996_vif_link_info link_info[IEEE80211_MLD_MAX_NUM_LINKS];
263+
259264
u8 mld_group_idx;
260265
u8 mld_remap_idx;
261266
};

0 commit comments

Comments
 (0)