wifi: mt76: mt7925: add NULL checks for MLO link pointers in MCU functions #1039
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.
Several MCU functions dereference pointers returned by
mt792x_sta_to_link()and
mt792x_vif_to_link()without checking for NULL. During MLO statetransitions, these functions can return NULL when link state is being
set up or torn down, causing kernel NULL pointer dereferences.
Add NULL checks in the following functions:
mt7925_mcu_sta_hdr_trans_tlv(): Check mlink before dereferencing wcidmt7925_mcu_wtbl_update_hdr_trans(): Check mlink and mconf before usemt7925_mcu_sta_amsdu_tlv(): Check mlink before setting amsdu flagmt7925_mcu_sta_mld_tlv(): Check mconf and mlink in link iteration loopmt7925_mcu_sta_update(): Initialize mlink to NULL and check bothlink_sta and mlink in the ternary condition
These race conditions can occur during:
The fixes follow the pattern used in mt7996 and ath12k drivers for
similar MLO link state handling.
Related PRs:
Testing: Found via code audit comparing against mt7996 and ath12k patterns.