[PATCH ath-next 0/6] wifi: ath11k, ath12k: RX correctness fixes

Julius Bairaktaris posted 6 patches 13 hours ago
drivers/net/wireless/ath/ath11k/dp_rx.c       | 86 ++++++++++++++++---
drivers/net/wireless/ath/ath11k/hw.c          | 22 +++++
drivers/net/wireless/ath/ath11k/hw.h          |  1 +
drivers/net/wireless/ath/ath12k/hal.h         |  1 +
drivers/net/wireless/ath/ath12k/wifi7/dp_rx.c | 14 ++-
.../wireless/ath/ath12k/wifi7/hal_qcc2072.c   | 11 +++
.../wireless/ath/ath12k/wifi7/hal_qcn9274.c   | 12 +++
.../wireless/ath/ath12k/wifi7/hal_wcn7850.c   | 12 +++
8 files changed, 147 insertions(+), 12 deletions(-)
[PATCH ath-next 0/6] wifi: ath11k, ath12k: RX correctness fixes
Posted by Julius Bairaktaris 13 hours ago
Six RX fixes for ath11k and ath12k. "The hardware" below is an
IPQ8074 hw2.0 with firmware WLAN.HK.2.12-01460.

1/6, 2/6: checksum trusted for frames the hardware did not check
- Trigger: an associated peer sends ICMP or ICMPv6 with a wrong
  checksum, or a UDP datagram with a wrong checksum in IP fragments.
- By the code, every ath11k and ath12k chip and frame mode.
- Shown on the hardware with OpenWrt's ath11k, switching at run time
  between ath-next's rule and this check, 50 frames per case, 1 run:
  with ath-next's rule the AP answered 50 of 50 ICMP echo requests with
  a wrong checksum and 50 of 50 fragmented UDP datagrams with a wrong
  checksum, and counted no checksum error; with the check it answered
  none and counted 50 errors each. Unfragmented UDP with a wrong
  checksum, which the hardware checks, was dropped both ways.
- Impact: the stack accepts such frames unchecked (icmp_rcv(), UDP
  after reassembly). CVSS 3.1: 3.5,
  AV:A/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N.
- Workaround: none; mac80211 offers no switch for RX checksum offload.
- Found by reading the code with an AI review tool.

3/6: ath11k delivers frames under a forged source address
- Trigger: a station associated to an ath11k AP turns on 4-address
  mode on its own side and sends data frames with any source address.
- Reachable with frame_mode=2 (Ethernet decap) only. On the hardware,
  an ath10k station sent 200 broadcasts with a forged source: all 200
  reached the AP's bridge, which learned the forged address on the
  Wi-Fi port. With an earlier version of the check, which hands such
  frames to mac80211 as 802.11 frames instead of dropping them, none
  did. One run each.
- Impact: a station can send frames as another host, and the bridge
  then sends that host's traffic to the Wi-Fi port, where it is lost.
  CVSS 3.1: 4.6, AV:A/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L.
- Workaround: the default frame_mode=1 (native Wi-Fi).
- Found by reading the code with an AI review tool, then reproduced as
  above.

4/6, 5/6: replay check of the group key skipped
- Trigger: a radio in range replays a recorded group-addressed data
  frame while the receiver gets unicast data; no key needed.
- Both drivers keep one receive status for all MSDUs of a REO reap and
  do not clear RX_FLAG_PN_VALIDATED between them, so a group-addressed
  MSDU behind a decrypted unicast one skips mac80211's replay check.
  Not reachable on the hardware: its firmware releases group-addressed
  MSDUs through the REO error path, which gives each MSDU its own
  status. An ath11k station under unicast load received 29011
  group-addressed MSDUs there, and none carried RX_FLAG_PN_VALIDATED
  in from an earlier MSDU. It would be reachable on a chip or firmware
  that delivers group-addressed MSDUs through the REO destination ring;
  none is known.
- Impact there: replayed group-addressed frames would be accepted.
  CVSS 3.1 if reachable: 3.1, AV:A/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N.
- Workaround: none needed on the hardware; elsewhere none.
- Found by reading the code with an AI review tool; measured as above.

6/6: ath12k loses EAPOL and group frames
- Trigger: an EAPOL frame, or a decrypted group-addressed frame,
  arrives in the same REO reap after a data frame of any station.
- Since commit c4aa897fe234 ("wifi: ath12k: Handle DP_RX_DECAP_TYPE_8023
  type in Rx path") ath12k sets RX_FLAG_8023 in the shared receive
  status and never clears it, so such a frame goes down mac80211's 802.3
  path with an 802.11 header and is lost. ath12k uses Ethernet decap
  without any setting when the firmware advertises
  WMI_TLV_SERVICE_ETH_OFFLOAD.
- Impact: 4-way handshakes and group rekeys stall until retried, and
  decrypted broadcasts such as ARP, ND and DHCP are lost. CVSS 3.1:
  2.6, AV:A/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L.
- Workaround: none.
- Found by reading the code with an AI review tool.

I used Claude (Anthropic) to help write these patches.

Julius Bairaktaris (6):
  wifi: ath11k: only trust the RX checksum of a frame the hardware
    checked
  wifi: ath12k: only trust the RX checksum of a frame the hardware
    checked
  wifi: ath11k: drop decapped frames with a source other than the
    station
  wifi: ath11k: clear the crypto flags of the receive status for each
    MSDU
  wifi: ath12k: clear the crypto flags of the receive status for each
    MSDU
  wifi: ath12k: clear RX_FLAG_8023 of the receive status for each MSDU

 drivers/net/wireless/ath/ath11k/dp_rx.c       | 86 ++++++++++++++++---
 drivers/net/wireless/ath/ath11k/hw.c          | 22 +++++
 drivers/net/wireless/ath/ath11k/hw.h          |  1 +
 drivers/net/wireless/ath/ath12k/hal.h         |  1 +
 drivers/net/wireless/ath/ath12k/wifi7/dp_rx.c | 14 ++-
 .../wireless/ath/ath12k/wifi7/hal_qcc2072.c   | 11 +++
 .../wireless/ath/ath12k/wifi7/hal_qcn9274.c   | 12 +++
 .../wireless/ath/ath12k/wifi7/hal_wcn7850.c   | 12 +++
 8 files changed, 147 insertions(+), 12 deletions(-)


base-commit: 1983b40acfcb3c3464b291c85977290a785bcfdc
-- 
2.53.0