wifi: mt76: mt7925: add NULL pointer checks in MLO paths #1030
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds defensive NULL pointer checks throughout the MT7925 driver to prevent
kernel panics during MLO (Multi-Link Operation) state transitions.
Problem
The MT7925 driver can crash with NULL pointer dereferences when:
mt792x_vif_to_bss_conf()returns NULL during link state transitionsmt792x_vif_to_link()returns NULL when link configuration is not yet set upmt792x_sta_to_link()returns NULL during station operationsThese conditions occur when the link configuration in mac80211 is not yet
synchronized with the driver's internal link tracking.
Changes
Patch 1: MCU STA TLV NULL checks (mcu.c)
mt7925_mcu_sta_phy_tlv(): Check link_conf and mconf before usemt7925_mcu_sta_rate_ctrl_tlv(): Check link_conf and mconf before usePatch 2: Main.c NULL checks
mt7925_set_key(): Check link_conf, mconf, and mlink before usemt7925_mac_link_sta_add(): Check link_conf before BSS info updatemt7925_mac_link_sta_assoc(): Check mlink and link_conf before usemt7925_mac_link_sta_remove(): Check mlink and link_conf with proper cleanupmt7925_change_vif_links(): Check link_conf before adding BSSTesting
Tested on Framework Desktop (AMD Ryzen AI Max 300 Series) with MT7925 WiFi.
These checks complement the mutex fixes in PR #1029.
Related
mt7925_vif_connect_iter()