linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Arik Nemtsov <arik@wizery.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH] mac80211: fix invalid band deref building preq IEs
Date: Mon, 09 Jul 2012 18:54:01 +0200	[thread overview]
Message-ID: <1341852841.4455.51.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <1341852581-8456-1-git-send-email-arik@wizery.com> (sfid-20120709_184946_798984_856287AB)

On Mon, 2012-07-09 at 19:49 +0300, Arik Nemtsov wrote:
> The function building probe-request IEs does not validate the band is
> supported before dereferencing it. This can result in a panic when
> all bands are traversed, as done during sched-scan start.
> 
> Warn when this happens and return an empty probe request. Also fix
> sched-scan to not waste memory on unsupported bands.
> 
> Signed-off-by: Arik Nemtsov <arik@wizery.com>
> ---
> This is not cc stable since the panic only started happening once
> the 60Ghz band was added. Apparently all sched-scan drivers supported
> all possible bands until then.
> 
> 
>  net/mac80211/scan.c |    3 +++
>  net/mac80211/util.c |    2 ++
>  2 files changed, 5 insertions(+)
> 
> diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
> index 379f178..1ff04f6 100644
> --- a/net/mac80211/scan.c
> +++ b/net/mac80211/scan.c
> @@ -928,6 +928,9 @@ int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
>  	}
>  
>  	for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
> +		if (!local->hw.wiphy->bands[i])
> +			continue;
> +
>  		local->sched_scan_ies.ie[i] = kzalloc(2 +
>  						      IEEE80211_MAX_SSID_LEN +
>  						      local->scan_ies_len +
> diff --git a/net/mac80211/util.c b/net/mac80211/util.c
> index 64493a7..503412a 100644
> --- a/net/mac80211/util.c
> +++ b/net/mac80211/util.c
> @@ -999,6 +999,8 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
>  	int ext_rates_len;
>  
>  	sband = local->hw.wiphy->bands[band];
> +	if (!WARN_ON_ONCE(sband))
> +		return 0;

That's not right :-)

johannes


  reply	other threads:[~2012-07-09 16:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-09 16:49 [PATCH] mac80211: fix invalid band deref building preq IEs Arik Nemtsov
2012-07-09 16:54 ` Johannes Berg [this message]
2012-07-09 16:55   ` Arik Nemtsov

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=1341852841.4455.51.camel@jlt3.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=arik@wizery.com \
    --cc=linux-wireless@vger.kernel.org \
    /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).