linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: David Kilroy <kilroyd@googlemail.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [RFC 5/5] cfg80211: scan before connect if we don't have the bss
Date: Wed, 19 Aug 2009 09:48:33 +0200	[thread overview]
Message-ID: <1250668113.16393.25.camel@johannes.local> (raw)
In-Reply-To: <1250640253-18434-6-git-send-email-kilroyd@googlemail.com>

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

On Wed, 2009-08-19 at 01:04 +0100, David Kilroy wrote:

> @@ -791,18 +824,55 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev,
>  
>  		return err;
>  	} else {
> +		struct cfg80211_bss *bss;
> +
>  		wdev->sme_state = CFG80211_SME_CONNECTING;
>  		wdev->connect_keys = connkeys;
> +
> +		bss = cfg80211_get_bss(wdev->wiphy, NULL, connect->bssid,
> +				       connect->ssid, connect->ssid_len,
> +				       WLAN_CAPABILITY_ESS,
> +				       WLAN_CAPABILITY_ESS);

Hmm. What if the bssid isn't set? Then the card might select a different
BSS than the one we have on the scan list.


> +			/* Failed to clone (or scan), so we can't
> +			 * delay the connect. Free everything up and
> +			 * go ahead with the connect */
> +			if (wdev->conn)
> +				kfree(wdev->conn->ie);
> +			kfree(wdev->conn);
> +			wdev->conn = NULL;

and that would then run into the warning and the problem anyway? Better
to just reject with -ENOMEM I think? Also, I really don't think you
should use wdev->conn anywhere in this code path, because some code
looks at that to figure out whether or not the cfg80211 SME is used.

> +		} else {
> +			cfg80211_put_bss(bss);

>  		err = rdev->ops->connect(&rdev->wiphy, dev, connect);

And it's all racy too -- by the time the driver calls connect_result(),
the BSS might have expired after it was found here now.

I don't think this is really feasible to implement in cfg80211. Couldn't
the driver do a probe to the BSS that the device selected, and report
that before the connect result?

johannes

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

  reply	other threads:[~2009-08-19  7:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-19  0:04 [RFC v2 0/5] orinoco: use cfg80211 for key manipulation David Kilroy
2009-08-19  0:04 ` [RFC 1/5] orinoco: add cfg80211 connect and disconnect David Kilroy
2009-08-19  0:04 ` [RFC 2/5] orinoco: add cfg80211 join_ibss and leave_ibss David Kilroy
2009-08-19  0:04 ` [RFC 3/5] orinoco: implement cfg80211 key manipulation functions David Kilroy
2009-08-19  0:04 ` [RFC 4/5] orinoco: do WE via cfg80211 David Kilroy
2009-08-19  0:04 ` [RFC 5/5] cfg80211: scan before connect if we don't have the bss David Kilroy
2009-08-19  7:48   ` Johannes Berg [this message]
2009-08-19 19:30     ` Dave
2009-08-19 19:37       ` Johannes Berg
2009-08-20 18:01         ` Dave
2009-08-20  6:39       ` Jussi Kivilinna
2009-08-31 17:59 ` [RFC v2 0/5] orinoco: use cfg80211 for key manipulation John W. Linville
2009-09-12 23:54   ` Dave Kilroy
2009-10-23 19:05     ` Dave
2009-10-26 13:17       ` Only device wlan1 but no connection Fritz!WLAN USB stick N2.4 Ed Vaessen
2009-10-26 14:57         ` Luis R. Rodriguez

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=1250668113.16393.25.camel@johannes.local \
    --to=johannes@sipsolutions.net \
    --cc=kilroyd@googlemail.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).