Skip to content

Commit 8141896

Browse files
committed
wifi: mt76: mt7996: prevent uninit return in mt7996_mac_sta_add_links
JIRA: https://issues.redhat.com/browse/RHEL-89168 commit d9bc625 Author: Qasim Ijaz <qasdev00@gmail.com> Date: Mon Apr 21 12:05:50 2025 +0100 wifi: mt76: mt7996: prevent uninit return in mt7996_mac_sta_add_links If link_conf_dereference_protected() or mt7996_vif_link() or link_sta_dereference_protected() fail the code jumps to the error_unlink label and returns ret which is uninitialised. Fix this by setting err before jumping to error_unlink. Fixes: c7e4fc3 ("wifi: mt76: mt7996: Update mt7996_mcu_add_sta to MLO support") Fixes: dd82a9e ("wifi: mt76: mt7996: Rely on mt7996_sta_link in sta_add/sta_remove callbacks") Signed-off-by: Qasim Ijaz <qasdev00@gmail.com> Link: https://patch.msgid.link/20250421110550.9839-1-qasdev00@gmail.com Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
1 parent 296a7f7 commit 8141896

File tree

1 file changed

+9
-3
lines changed
  • drivers/net/wireless/mediatek/mt76/mt7996

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -998,16 +998,22 @@ mt7996_mac_sta_add_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
998998
continue;
999999

10001000
link_conf = link_conf_dereference_protected(vif, link_id);
1001-
if (!link_conf)
1001+
if (!link_conf) {
1002+
err = -EINVAL;
10021003
goto error_unlink;
1004+
}
10031005

10041006
link = mt7996_vif_link(dev, vif, link_id);
1005-
if (!link)
1007+
if (!link) {
1008+
err = -EINVAL;
10061009
goto error_unlink;
1010+
}
10071011

10081012
link_sta = link_sta_dereference_protected(sta, link_id);
1009-
if (!link_sta)
1013+
if (!link_sta) {
1014+
err = -EINVAL;
10101015
goto error_unlink;
1016+
}
10111017

10121018
err = mt7996_mac_sta_init_link(dev, link_conf, link_sta, link,
10131019
link_id);

0 commit comments

Comments
 (0)