* [PATCH 5.15.y] wifi: cfg80211: check A-MSDU format more carefully
@ 2025-05-13 2:06 jianqi.ren.cn
2025-05-13 18:50 ` Sasha Levin
0 siblings, 1 reply; 4+ messages in thread
From: jianqi.ren.cn @ 2025-05-13 2:06 UTC (permalink / raw)
To: gregkh, stable
Cc: patches, linux-kernel, jianqi.ren.cn, johannes, davem, kuba,
linux-wireless, netdev, johannes.berg
From: Johannes Berg <johannes.berg@intel.com>
[ Upstream commit 9ad7974856926129f190ffbe3beea78460b3b7cc ]
If it looks like there's another subframe in the A-MSDU
but the header isn't fully there, we can end up reading
data out of bounds, only to discard later. Make this a
bit more careful and check if the subframe header can
even be present.
Reported-by: syzbot+d050d437fe47d479d210@syzkaller.appspotmail.com
Link: https://msgid.link/20240226203405.a731e2c95e38.I82ce7d8c0cc8970ce29d0a39fdc07f1ffc425be4@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[Minor conflict resolved due to code context change. And routine
ieee80211_is_valid_amsdu is introduced by commit fe4a6d2db3ba
("wifi: mac80211: implement support for yet another mesh A-MSDU format")
after 6.4.]
Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
Signed-off-by: He Zhe <zhe.he@windriver.com>
---
Verified the build test
---
net/wireless/util.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 6ebc6567b287..0fd48361e3e1 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -751,24 +751,27 @@ void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
struct sk_buff *frame = NULL;
u16 ethertype;
u8 *payload;
- int offset = 0, remaining;
+ int offset = 0;
struct ethhdr eth;
bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb);
bool reuse_skb = false;
bool last = false;
while (!last) {
+ int remaining = skb->len - offset;
unsigned int subframe_len;
int len;
u8 padding;
+ if (sizeof(eth) > remaining)
+ goto purge;
+
skb_copy_bits(skb, offset, ð, sizeof(eth));
len = ntohs(eth.h_proto);
subframe_len = sizeof(struct ethhdr) + len;
padding = (4 - subframe_len) & 0x3;
/* the last MSDU has no padding */
- remaining = skb->len - offset;
if (subframe_len > remaining)
goto purge;
/* mitigate A-MSDU aggregation injection attacks */
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 5.15.y] wifi: cfg80211: check A-MSDU format more carefully
@ 2025-05-13 2:09 jianqi.ren.cn
2025-05-13 18:51 ` Sasha Levin
0 siblings, 1 reply; 4+ messages in thread
From: jianqi.ren.cn @ 2025-05-13 2:09 UTC (permalink / raw)
To: gregkh, stable
Cc: patches, linux-kernel, jianqi.ren.cn, johannes, davem, kuba,
linux-wireless, netdev, johannes.berg
From: Johannes Berg <johannes.berg@intel.com>
[ Upstream commit 9ad7974856926129f190ffbe3beea78460b3b7cc ]
If it looks like there's another subframe in the A-MSDU
but the header isn't fully there, we can end up reading
data out of bounds, only to discard later. Make this a
bit more careful and check if the subframe header can
even be present.
Reported-by: syzbot+d050d437fe47d479d210@syzkaller.appspotmail.com
Link: https://msgid.link/20240226203405.a731e2c95e38.I82ce7d8c0cc8970ce29d0a39fdc07f1ffc425be4@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[Minor conflict resolved due to code context change. And routine
ieee80211_is_valid_amsdu is introduced by commit fe4a6d2db3ba
("wifi: mac80211: implement support for yet another mesh A-MSDU format")
after 6.4.]
Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
Signed-off-by: He Zhe <zhe.he@windriver.com>
---
Verified the build test
---
net/wireless/util.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 6ebc6567b287..0fd48361e3e1 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -751,24 +751,27 @@ void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
struct sk_buff *frame = NULL;
u16 ethertype;
u8 *payload;
- int offset = 0, remaining;
+ int offset = 0;
struct ethhdr eth;
bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb);
bool reuse_skb = false;
bool last = false;
while (!last) {
+ int remaining = skb->len - offset;
unsigned int subframe_len;
int len;
u8 padding;
+ if (sizeof(eth) > remaining)
+ goto purge;
+
skb_copy_bits(skb, offset, ð, sizeof(eth));
len = ntohs(eth.h_proto);
subframe_len = sizeof(struct ethhdr) + len;
padding = (4 - subframe_len) & 0x3;
/* the last MSDU has no padding */
- remaining = skb->len - offset;
if (subframe_len > remaining)
goto purge;
/* mitigate A-MSDU aggregation injection attacks */
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 5.15.y] wifi: cfg80211: check A-MSDU format more carefully
2025-05-13 2:06 jianqi.ren.cn
@ 2025-05-13 18:50 ` Sasha Levin
0 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2025-05-13 18:50 UTC (permalink / raw)
To: stable; +Cc: jianqi.ren.cn, Sasha Levin
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected.
No action required from the submitter.
The upstream commit SHA1 provided is correct: 9ad7974856926129f190ffbe3beea78460b3b7cc
WARNING: Author mismatch between patch and upstream commit:
Backport author: <jianqi.ren.cn@windriver.com>
Commit author: Johannes Berg<johannes.berg@intel.com>
Status in newer kernel trees:
6.14.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)
6.6.y | Present (different SHA1: 5d7a8585fbb3)
6.1.y | Present (different SHA1: 9eb3bc0973d0)
Note: The patch differs from the upstream commit:
---
1: 9ad7974856926 < -: ------------- wifi: cfg80211: check A-MSDU format more carefully
-: ------------- > 1: 33a029c3b922f wifi: cfg80211: check A-MSDU format more carefully
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-5.15.y | Success | Success |
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 5.15.y] wifi: cfg80211: check A-MSDU format more carefully
2025-05-13 2:09 [PATCH 5.15.y] wifi: cfg80211: check A-MSDU format more carefully jianqi.ren.cn
@ 2025-05-13 18:51 ` Sasha Levin
0 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2025-05-13 18:51 UTC (permalink / raw)
To: stable; +Cc: jianqi.ren.cn, Sasha Levin
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected.
No action required from the submitter.
The upstream commit SHA1 provided is correct: 9ad7974856926129f190ffbe3beea78460b3b7cc
WARNING: Author mismatch between patch and upstream commit:
Backport author: <jianqi.ren.cn@windriver.com>
Commit author: Johannes Berg<johannes.berg@intel.com>
Status in newer kernel trees:
6.14.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)
6.6.y | Present (different SHA1: 5d7a8585fbb3)
6.1.y | Present (different SHA1: 9eb3bc0973d0)
Note: The patch differs from the upstream commit:
---
1: 9ad7974856926 < -: ------------- wifi: cfg80211: check A-MSDU format more carefully
-: ------------- > 1: af32816746f4e wifi: cfg80211: check A-MSDU format more carefully
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-5.15.y | Success | Success |
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-05-13 18:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-13 2:09 [PATCH 5.15.y] wifi: cfg80211: check A-MSDU format more carefully jianqi.ren.cn
2025-05-13 18:51 ` Sasha Levin
-- strict thread matches above, loose matches on Subject: below --
2025-05-13 2:06 jianqi.ren.cn
2025-05-13 18:50 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox