mac80211_hwsim: correctly handle zero length frames
Subsystems (3)
PATCH 1/1 mac80211_hwsim: correctly handle zero length frames
syzbot, using KMSAN, has reported an uninit-value access in hwsim_cloned_frame_received_nl(). This is happening because frame_data_len is 0. The code doesn't detect this case and blindly tries to read the frame's header.
Fix this by bailing out in case frame_data_len is 0.
--- drivers/net/wireless/mac80211_hwsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mac80211_hwsim.c +1 -1
@@ -3649,7 +3649,7 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,if (skb ==NULL ) goto err; -if (frame_data_len >IEEE80211_MAX_DATA_LEN ) +if (frame_data_len ==0 || frame_data_len >IEEE80211_MAX_DATA_LEN ) goto err;/* Copy the data */
Signature · 6 lines
2.26.2 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Johannes Berg
maintainerQuoted 6 lines · Anirudh Rayabharam
syzbot, using KMSAN, has reported an uninit-value access in
hwsim_cloned_frame_received_nl(). This is happening becauseframe_data_lenis 0. The code doesn't detect this case and blindly tries to read the frame's header.Fix this by bailing out in case
frame_data_lenis 0.
This really seems quite pointless - you should bail out if the frame is too short for what we need to do, not just when it's 0.
johannes
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 10 lines · Johannes Berg
Quoted 6 lines · Anirudh Rayabharam
syzbot, using KMSAN, has reported an uninit-value access in
hwsim_cloned_frame_received_nl(). This is happening becauseframe_data_lenis 0. The code doesn't detect this case and blindly tries to read the frame's header.Fix this by bailing out in case
frame_data_lenis 0.This really seems quite pointless - you should bail out if the frame is too short for what we need to do, not just when it's 0.
That makes sense. Do you happen to know what the min length of a valid frame is? There doesn't seem to be constant defined for that already.
- Anirudh
Quoted 3 lines
johannes