* [PATCH] mac80211_hwsim: correctly handle zero length frames
@ 2021-06-10 16:19 Anirudh Rayabharam
2021-06-18 9:36 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Anirudh Rayabharam @ 2021-06-10 16:19 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo, David S. Miller, Jakub Kicinski
Cc: gregkh, linux-kernel-mentees, Anirudh Rayabharam,
syzbot+b2645b5bf1512b81fa22, linux-wireless, netdev,
linux-kernel
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.
Reported-by: syzbot+b2645b5bf1512b81fa22@syzkaller.appspotmail.com
Tested-by: syzbot+b2645b5bf1512b81fa22@syzkaller.appspotmail.com
Signed-off-by: Anirudh Rayabharam <mail@anirudhrb.com>
---
drivers/net/wireless/mac80211_hwsim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 51ce767eaf88..ccfe40313109 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -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 */
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mac80211_hwsim: correctly handle zero length frames
2021-06-10 16:19 [PATCH] mac80211_hwsim: correctly handle zero length frames Anirudh Rayabharam
@ 2021-06-18 9:36 ` Johannes Berg
2021-06-23 7:26 ` Anirudh Rayabharam
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2021-06-18 9:36 UTC (permalink / raw)
To: Anirudh Rayabharam, Kalle Valo, David S. Miller, Jakub Kicinski
Cc: gregkh, linux-kernel-mentees, syzbot+b2645b5bf1512b81fa22,
linux-wireless, netdev, linux-kernel
On Thu, 2021-06-10 at 21:49 +0530, Anirudh Rayabharam wrote:
> 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.
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mac80211_hwsim: correctly handle zero length frames
2021-06-18 9:36 ` Johannes Berg
@ 2021-06-23 7:26 ` Anirudh Rayabharam
0 siblings, 0 replies; 3+ messages in thread
From: Anirudh Rayabharam @ 2021-06-23 7:26 UTC (permalink / raw)
To: Johannes Berg
Cc: Kalle Valo, David S. Miller, Jakub Kicinski, gregkh,
linux-kernel-mentees, syzbot+b2645b5bf1512b81fa22,
linux-wireless, netdev, linux-kernel, mail
On Fri, Jun 18, 2021 at 11:36:16AM +0200, Johannes Berg wrote:
> On Thu, 2021-06-10 at 21:49 +0530, Anirudh Rayabharam wrote:
> > 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.
>
> 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
>
> johannes
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-23 7:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10 16:19 [PATCH] mac80211_hwsim: correctly handle zero length frames Anirudh Rayabharam
2021-06-18 9:36 ` Johannes Berg
2021-06-23 7:26 ` Anirudh Rayabharam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).