From: Benjamin Lin benjamin-jw.lin@mediatek.com
[ Upstream commit 80fda1cd7b0a1edd0849dc71403a070d0922118d ]
IEEE 802.11 fragmentation can only be applied to unicast frames. Therefore, drop fragments with multicast or broadcast RA. This patch addresses vulnerabilities such as CVE-2020-26145.
Signed-off-by: Benjamin Lin benjamin-jw.lin@mediatek.com Signed-off-by: Shayne Chen shayne.chen@mediatek.com Link: https://patch.msgid.link/20250515032952.1653494-4-shayne.chen@mediatek.com Signed-off-by: Felix Fietkau nbd@nbd.name Signed-off-by: Sasha Levin sashal@kernel.org ---
## Analysis Complete **YES** This commit should be backported to stable kernel trees. Here's my extensive analysis: ### Security Fix for Known CVE The commit directly addresses **CVE-2020-26145**, a documented security vulnerability related to improper handling of fragmented frames with multicast/broadcast addresses. This is explicitly mentioned in the commit message and code comments. ### Code Analysis The change adds a critical security check in `drivers/net/wireless/mediatek/mt76/mt7996/mac.c` in the `mt7996_mac_fill_rx()` function: ```c /bin /bin.usr-is-merged /boot /dev /etc /home /init /lib /lib.usr-is-merged /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /sbin.usr-is-merged /snap /srv /sys /tmp /usr /var IEEE 802.11 fragmentation can only be applied to unicast frames. linux Hence, drop fragments with multicast/broadcast RA. linux This check fixes vulnerabilities, like CVE-2020-26145. linux/ if ((ieee80211_has_morefrags(fc) || seq_ctrl & IEEE80211_SCTL_FRAG) && FIELD_GET(MT_RXD3_NORMAL_ADDR_TYPE, rxd3) != MT_RXD3_NORMAL_U2M) return -EINVAL; ``` The logic checks: 1. **Fragment detection**: `ieee80211_has_morefrags(fc)` detects if there are more fragments, and `seq_ctrl & IEEE80211_SCTL_FRAG` checks the fragment number field 2. **Address type filtering**: `FIELD_GET(MT_RXD3_NORMAL_ADDR_TYPE, rxd3) != MT_RXD3_NORMAL_U2M` ensures only unicast-to-multicast (U2M) frames are allowed when fragmented ### Comparison with Similar Commits Looking at the historical examples: **Similar Backported Commits (Status: YES):** - ath10k commits dropping multicast fragments (both PCIe and SDIO versions) for the same CVE-2020-26145 - mt7915 fragmentation threshold dummy implementation **Pattern Match:** This commit follows the exact same pattern as the successfully backported ath10k commits that address CVE-2020-26145 by dropping fragmented frames with multicast/broadcast destination addresses. ### Risk Assessment **Low Risk:** - **Small, contained change**: Only 4 lines of code added - **Early validation**: Check happens early in the RX path before frame processing - **Conservative approach**: Drops potentially malicious frames rather than processing them - **No architectural changes**: Doesn't modify existing data structures or interfaces - **Clear error path**: Returns `-EINVAL` which is a standard error handling pattern in this codebase **High Security Benefit:** - Addresses a known CVE affecting wireless security - Prevents potential exploitation through malformed fragmented multicast frames - Aligns with IEEE 802.11 standard (fragmentation only for unicast) ### Subsystem Stability The mt7996 driver is part of the MediaTek mt76 wireless driver family, and similar security fixes have been successfully backported to other drivers in this family without issues. ### Conclusion This is a textbook example of a commit that should be backported: it's a small, low-risk security fix for a documented CVE, follows established patterns from other successful backports, and provides important protection against a wireless security vulnerability.
drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c index ef2d7eaaaffdd..0990a3d481f2d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c @@ -623,6 +623,14 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q, status->last_amsdu = amsdu_info == MT_RXD4_LAST_AMSDU_FRAME; }
+ /* IEEE 802.11 fragmentation can only be applied to unicast frames. + * Hence, drop fragments with multicast/broadcast RA. + * This check fixes vulnerabilities, like CVE-2020-26145. + */ + if ((ieee80211_has_morefrags(fc) || seq_ctrl & IEEE80211_SCTL_FRAG) && + FIELD_GET(MT_RXD3_NORMAL_ADDR_TYPE, rxd3) != MT_RXD3_NORMAL_U2M) + return -EINVAL; + hdr_gap = (u8 *)rxd - skb->data + 2 * remove_pad; if (hdr_trans && ieee80211_has_morefrags(fc)) { if (mt7996_reverse_frag0_hdr_trans(skb, hdr_gap))