From: "Tomas Winkler" <tomasw@gmail.com>
To: "Johannes Berg" <johannes@sipsolutions.net>
Cc: "Helmut Schaa" <hschaa@suse.de>,
"John Linville" <linville@tuxdriver.com>,
"Larry Finger" <Larry.Finger@lwfinger.net>,
linux-wireless@vger.kernel.org
Subject: Re: [PATCHv5] mac80211: fix NULL pointer dereference in ieee80211_compatible_rates
Date: Tue, 20 May 2008 16:11:41 +0300 [thread overview]
Message-ID: <1ba2fa240805200611o7c221c86na2c627242a2ce67@mail.gmail.com> (raw)
In-Reply-To: <1211288251.6252.86.camel@johannes.berg>
On Tue, May 20, 2008 at 3:57 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Tue, 2008-05-20 at 15:54 +0300, Tomas Winkler wrote:
>> On Tue, May 20, 2008 at 10:56 AM, 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..3f7f92a 100644
>> > --- a/net/mac80211/mlme.c
>> > +++ b/net/mac80211/mlme.c
>> > @@ -721,7 +721,17 @@ static void ieee80211_send_assoc(struct net_device
>> > *dev,
>> > capab |= WLAN_CAPABILITY_PRIVACY;
>> > if (bss->wmm_ie)
>> > wmm = 1;
>> > +
>> > + /* 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);
>> > +
>> > ieee80211_rx_bss_put(dev, bss);
>> > + } else {
>> > + rates = ~0;
>> > + rates_len = sband->n_bitrates;
>> > }
>> >
>> > mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
>> > @@ -752,10 +762,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;
>> >
>> >
>>
>> I found one ieee80211_rx_bss_{get,put} imbalance in
>> ieee80211_sta_join_ibss function
>> That may cause this problem yet it doesn't look like this is the case.
>> ieee80211_sta_join_ibss
>> calls ieee80211_rx_bss_put on 'bss' that it receives as an argument
>> Keep searching.
>
> Hm. Send a patch? :)
>
Searching for the real problem ...
>> I suggest to insert at least some WARN_ON(1) for the else case.
>
> Disagree, not until somebody audits the code. We already know it can
> happen and a WARN() won't help us track it down because it provides no
> additional information (stack trace is useless)
What about printk(KERN_WARN ), The else statement actually means that
something wrong happened.
Tomas
next prev parent reply other threads:[~2008-05-20 13:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-20 7:56 [PATCHv5] mac80211: fix NULL pointer dereference in ieee80211_compatible_rates Helmut Schaa
2008-05-20 12:54 ` Tomas Winkler
2008-05-20 12:57 ` Johannes Berg
2008-05-20 13:11 ` Tomas Winkler [this message]
2008-05-20 13:22 ` Johannes Berg
2008-05-20 13:33 ` Tomas Winkler
2008-05-20 13:38 ` Johannes Berg
2008-05-20 13:44 ` Tomas Winkler
2008-05-20 13:47 ` Larry Finger
2008-05-20 14:20 ` John W. Linville
2008-05-20 14:41 ` Tomas Winkler
2008-05-21 10:47 ` Tomas Winkler
2008-05-21 13:54 ` John W. Linville
2008-05-21 14:50 ` Tomas Winkler
2008-05-21 15:08 ` Johannes Berg
2008-05-21 15:11 ` Tomas Winkler
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=1ba2fa240805200611o7c221c86na2c627242a2ce67@mail.gmail.com \
--to=tomasw@gmail.com \
--cc=Larry.Finger@lwfinger.net \
--cc=hschaa@suse.de \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.