Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCHv4] mac80211: fix NULL pointer dereference in ieee80211_compatible_rates
@ 2008-05-19 14:59 Helmut Schaa
  2008-05-19 15:05 ` Johannes Berg
  2008-05-19 17:02 ` Tomas Winkler
  0 siblings, 2 replies; 4+ messages in thread
From: Helmut Schaa @ 2008-05-19 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Johannes Berg, Larry Finger, linux-wireless

Fix a possible NULL pointer dereference in ieee80211_compatible_rates 
introduced in the patch "mac80211: fix association with some APs". If no bss
is available just use all supported rates in the association request.

Signed-off-by: Helmut Schaa <hschaa@suse.de>
---

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 76ad4ed..7aff784 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -722,6 +722,15 @@ static void ieee80211_send_assoc(struct net_device *dev,
 		if (bss->wmm_ie)
 			wmm = 1;
 		ieee80211_rx_bss_put(dev, bss);
+
+		/* get all rates supported by the device and the AP as
+		 * some APs don't like getting a superset of their rates
+		 * in the association request (e.g. D-Link DAP 1353 in
+		 * b-only mode) */
+		rates_len = ieee80211_compatible_rates(bss, sband, &rates);
+	} else {
+		rates = ~0;
+		rates_len = sband->n_bitrates;
 	}
 
 	mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
@@ -752,10 +761,7 @@ static void ieee80211_send_assoc(struct net_device *dev,
 	*pos++ = ifsta->ssid_len;
 	memcpy(pos, ifsta->ssid, ifsta->ssid_len);
 
-	/* all supported rates should be added here but some APs
-	 * (e.g. D-Link DAP 1353 in b-only mode) don't like that
-	 * Therefore only add rates the AP supports */
-	rates_len = ieee80211_compatible_rates(bss, sband, &rates);
+	/* add all rates which were marked to be used above */
 	supp_rates_len = rates_len;
 	if (supp_rates_len > 8)
 		supp_rates_len = 8;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCHv4] mac80211: fix NULL pointer dereference in ieee80211_compatible_rates
  2008-05-19 14:59 [PATCHv4] mac80211: fix NULL pointer dereference in ieee80211_compatible_rates Helmut Schaa
@ 2008-05-19 15:05 ` Johannes Berg
  2008-05-19 17:02 ` Tomas Winkler
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2008-05-19 15:05 UTC (permalink / raw)
  To: Helmut Schaa; +Cc: John Linville, Larry Finger, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1695 bytes --]

On Mon, 2008-05-19 at 16:59 +0200, Helmut Schaa wrote:
> Fix a possible NULL pointer dereference in ieee80211_compatible_rates 
> introduced in the patch "mac80211: fix association with some APs". If no bss
> is available just use all supported rates in the association request.
> 
> Signed-off-by: Helmut Schaa <hschaa@suse.de>

Thanks.
Acked-by: Johannes Berg <johannes@sipsolutions.net>

> ---
> 
> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> index 76ad4ed..7aff784 100644
> --- a/net/mac80211/mlme.c
> +++ b/net/mac80211/mlme.c
> @@ -722,6 +722,15 @@ static void ieee80211_send_assoc(struct net_device *dev,
>  		if (bss->wmm_ie)
>  			wmm = 1;
>  		ieee80211_rx_bss_put(dev, bss);
> +
> +		/* get all rates supported by the device and the AP as
> +		 * some APs don't like getting a superset of their rates
> +		 * in the association request (e.g. D-Link DAP 1353 in
> +		 * b-only mode) */
> +		rates_len = ieee80211_compatible_rates(bss, sband, &rates);
> +	} else {
> +		rates = ~0;
> +		rates_len = sband->n_bitrates;
>  	}
>  
>  	mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
> @@ -752,10 +761,7 @@ static void ieee80211_send_assoc(struct net_device *dev,
>  	*pos++ = ifsta->ssid_len;
>  	memcpy(pos, ifsta->ssid, ifsta->ssid_len);
>  
> -	/* all supported rates should be added here but some APs
> -	 * (e.g. D-Link DAP 1353 in b-only mode) don't like that
> -	 * Therefore only add rates the AP supports */
> -	rates_len = ieee80211_compatible_rates(bss, sband, &rates);
> +	/* add all rates which were marked to be used above */
>  	supp_rates_len = rates_len;
>  	if (supp_rates_len > 8)
>  		supp_rates_len = 8;
> 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCHv4] mac80211: fix NULL pointer dereference in ieee80211_compatible_rates
  2008-05-19 14:59 [PATCHv4] mac80211: fix NULL pointer dereference in ieee80211_compatible_rates Helmut Schaa
  2008-05-19 15:05 ` Johannes Berg
@ 2008-05-19 17:02 ` Tomas Winkler
  2008-05-19 17:29   ` Johannes Berg
  1 sibling, 1 reply; 4+ messages in thread
From: Tomas Winkler @ 2008-05-19 17:02 UTC (permalink / raw)
  To: Helmut Schaa; +Cc: John Linville, Johannes Berg, Larry Finger, linux-wireless

On Mon, May 19, 2008 at 5:59 PM, Helmut Schaa <hschaa@suse.de> wrote:
> Fix a possible NULL pointer dereference in ieee80211_compatible_rates
> introduced in the patch "mac80211: fix association with some APs". If no bss
> is available just use all supported rates in the association request.
>
> Signed-off-by: Helmut Schaa <hschaa@suse.de>
> ---
>
> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> index 76ad4ed..7aff784 100644
> --- a/net/mac80211/mlme.c
> +++ b/net/mac80211/mlme.c
> @@ -722,6 +722,15 @@ static void ieee80211_send_assoc(struct net_device *dev,
>                if (bss->wmm_ie)
>                        wmm = 1;
>                ieee80211_rx_bss_put(dev, bss);
> +
> +               /* get all rates supported by the device and the AP as
> +                * some APs don't like getting a superset of their rates
> +                * in the association request (e.g. D-Link DAP 1353 in
> +                * b-only mode) */
> +               rates_len = ieee80211_compatible_rates(bss, sband, &rates);

Shuldn' t this call ieee80211_rx_bss_put(dev, bss);  after calling
ieee80211_compatible_rates()


> +       } else {
> +               rates = ~0;
> +               rates_len = sband->n_bitrates;
>        }
>
>        mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
> @@ -752,10 +761,7 @@ static void ieee80211_send_assoc(struct net_device *dev,
>        *pos++ = ifsta->ssid_len;
>        memcpy(pos, ifsta->ssid, ifsta->ssid_len);
>
> -       /* all supported rates should be added here but some APs
> -        * (e.g. D-Link DAP 1353 in b-only mode) don't like that
> -        * Therefore only add rates the AP supports */
> -       rates_len = ieee80211_compatible_rates(bss, sband, &rates);
> +       /* add all rates which were marked to be used above */
>        supp_rates_len = rates_len;
>        if (supp_rates_len > 8)
>                supp_rates_len = 8;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCHv4] mac80211: fix NULL pointer dereference in ieee80211_compatible_rates
  2008-05-19 17:02 ` Tomas Winkler
@ 2008-05-19 17:29   ` Johannes Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2008-05-19 17:29 UTC (permalink / raw)
  To: Tomas Winkler; +Cc: Helmut Schaa, John Linville, Larry Finger, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1358 bytes --]

On Mon, 2008-05-19 at 20:02 +0300, Tomas Winkler wrote:
> On Mon, May 19, 2008 at 5:59 PM, Helmut Schaa <hschaa@suse.de> wrote:
> > Fix a possible NULL pointer dereference in ieee80211_compatible_rates
> > introduced in the patch "mac80211: fix association with some APs". If no bss
> > is available just use all supported rates in the association request.
> >
> > Signed-off-by: Helmut Schaa <hschaa@suse.de>
> > ---
> >
> > diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> > index 76ad4ed..7aff784 100644
> > --- a/net/mac80211/mlme.c
> > +++ b/net/mac80211/mlme.c
> > @@ -722,6 +722,15 @@ static void ieee80211_send_assoc(struct net_device *dev,
> >                if (bss->wmm_ie)
> >                        wmm = 1;
> >                ieee80211_rx_bss_put(dev, bss);
> > +
> > +               /* get all rates supported by the device and the AP as
> > +                * some APs don't like getting a superset of their rates
> > +                * in the association request (e.g. D-Link DAP 1353 in
> > +                * b-only mode) */
> > +               rates_len = ieee80211_compatible_rates(bss, sband, &rates);
> 
> Shuldn' t this call ieee80211_rx_bss_put(dev, bss);  after calling
> ieee80211_compatible_rates()

Ahrg. Umm, yes, of course. D'oh. I really need to look at things better,
thanks.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-05-19 17:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-19 14:59 [PATCHv4] mac80211: fix NULL pointer dereference in ieee80211_compatible_rates Helmut Schaa
2008-05-19 15:05 ` Johannes Berg
2008-05-19 17:02 ` Tomas Winkler
2008-05-19 17:29   ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox