* [PATCH ath-current] wifi: ath6kl: avoid A-MSDU subframe overread in aggr_slice_amsdu()
@ 2026-11-19 9:57 Maoyi Xie
0 siblings, 0 replies; only message in thread
From: Maoyi Xie @ 2026-11-19 9:57 UTC (permalink / raw)
To: Jeff Johnson
Cc: Vasanthakumar Thiagarajan, linux-wireless, linux-kernel, stable
For each subframe from the device, aggr_slice_amsdu() checks the
payload length only against the range 46 to 1508, not against
amsdu_len, the bytes left. A subframe longer than the bytes left makes
memcpy() read past the received data. The u16 amsdu_len also wraps
when the frame ends inside the padding of a subframe or is shorter
than an Ethernet header. The loop then reads past the frame.
Check each subframe and its padding against the bytes left. Treat a
frame shorter than an Ethernet header as empty.
Found with a CodeQL-based static analysis tool that we are developing.
Reproduced in a userspace harness under AddressSanitizer, which reports
nothing in aggr_slice_amsdu() with this patch. Not tested on hardware,
only compile-tested with W=1 on next-20261116.
Fixes: bdcd81707973 ("Add ath6kl cleaned up driver")
Cc: stable@vger.kernel.org
Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com>
---
I used an LLM to help write the harness and this patch.
drivers/net/wireless/ath/ath6kl/txrx.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/txrx.c b/drivers/net/wireless/ath/ath6kl/txrx.c
index 609d458ca6c5730..7ae14d470627276 100644
--- a/drivers/net/wireless/ath/ath6kl/txrx.c
+++ b/drivers/net/wireless/ath/ath6kl/txrx.c
@@ -997,14 +997,15 @@ static void aggr_slice_amsdu(struct aggr_info *p_aggr,
mac_hdr_len = sizeof(struct ethhdr);
framep = skb->data + mac_hdr_len;
- amsdu_len = skb->len - mac_hdr_len;
+ amsdu_len = skb->len > mac_hdr_len ? skb->len - mac_hdr_len : 0;
while (amsdu_len > mac_hdr_len) {
hdr = (struct ethhdr *) framep;
payload_8023_len = be16_to_cpu(hdr->h_proto);
if (payload_8023_len < MIN_MSDU_SUBFRAME_PAYLOAD_LEN ||
- payload_8023_len > MAX_MSDU_SUBFRAME_PAYLOAD_LEN) {
+ payload_8023_len > MAX_MSDU_SUBFRAME_PAYLOAD_LEN ||
+ payload_8023_len + mac_hdr_len > amsdu_len) {
ath6kl_err("802.3 AMSDU frame bound check failed. len %d\n",
payload_8023_len);
break;
@@ -1035,6 +1036,8 @@ static void aggr_slice_amsdu(struct aggr_info *p_aggr,
* Round to nearest word.
*/
frame_8023_len = ALIGN(frame_8023_len, 4);
+ if (frame_8023_len > amsdu_len)
+ break;
framep += frame_8023_len;
amsdu_len -= frame_8023_len;
base-commit: 7e1392a42ea288d70a266f6553fe06f57f8647ea
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-19 9:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 9:57 [PATCH ath-current] wifi: ath6kl: avoid A-MSDU subframe overread in aggr_slice_amsdu() Maoyi Xie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®