linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Johnson <quic_jjohnson@quicinc.com>
To: Johannes Berg <johannes@sipsolutions.net>,
	<linux-wireless@vger.kernel.org>
Cc: Johannes Berg <johannes.berg@intel.com>,
	<syzbot+b2645b5bf1512b81fa22@syzkaller.appspotmail.com>
Subject: Re: [PATCH] wifi: mac80211_hwsim: drop short frames
Date: Tue, 15 Aug 2023 11:20:43 -0700	[thread overview]
Message-ID: <07997950-0f1b-cc05-6ba4-1378dc35eec8@quicinc.com> (raw)
In-Reply-To: <20230815181603.f576bd983875.I1efbeef082c3f7094037882f213202d760848eb7@changeid>

On 8/15/2023 9:16 AM, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> Frames that don't even have addr1 are clearly not valid,
> drop those early in the netlink/wmediumd path here.
> 
> Reported-by: syzbot+b2645b5bf1512b81fa22@syzkaller.appspotmail.com
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
>   drivers/net/wireless/virtual/mac80211_hwsim.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c
> index f446fd0e8cd0..8f1e4420ed1e 100644
> --- a/drivers/net/wireless/virtual/mac80211_hwsim.c
> +++ b/drivers/net/wireless/virtual/mac80211_hwsim.c
> @@ -5626,14 +5626,15 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,
>   	frame_data_len = nla_len(info->attrs[HWSIM_ATTR_FRAME]);
>   	frame_data = (void *)nla_data(info->attrs[HWSIM_ATTR_FRAME]);
>   
> +	if (frame_data_len < offsetofend(typeof(*hdr), addr1) ||

curious why addr1. if the frame ends after addr1 then don't you have a 
problem in mac80211_hwsim_rx() when it passes hdr->addr2 to 
ieee80211_find_sta_by_link_addrs()?


> +	    frame_data_len > IEEE80211_MAX_DATA_LEN)
> +		goto err;
> +
>   	/* Allocate new skb here */
>   	skb = alloc_skb(frame_data_len, GFP_KERNEL);
>   	if (skb == NULL)
>   		goto err;
>   
> -	if (frame_data_len > IEEE80211_MAX_DATA_LEN)
> -		goto err;
> -
>   	/* Copy the data */
>   	skb_put_data(skb, frame_data, frame_data_len);
>   


  reply	other threads:[~2023-08-15 18:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-15 16:16 [PATCH] wifi: mac80211_hwsim: drop short frames Johannes Berg
2023-08-15 18:20 ` Jeff Johnson [this message]
2023-08-15 19:25   ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=07997950-0f1b-cc05-6ba4-1378dc35eec8@quicinc.com \
    --to=quic_jjohnson@quicinc.com \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=syzbot+b2645b5bf1512b81fa22@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).