From: Stanislaw Gruszka <sgruszka@redhat.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Ben Greear <greearb@candelatech.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: Latest wireless-testing has broken scan locking.
Date: Thu, 7 Oct 2010 11:18:40 +0200 [thread overview]
Message-ID: <20101007091839.GC2435@redhat.com> (raw)
In-Reply-To: <1286440488.3657.23.camel@jlt3.sipsolutions.net>
On Thu, Oct 07, 2010 at 10:34:48AM +0200, Johannes Berg wrote:
> On Wed, 2010-10-06 at 21:13 -0700, Ben Greear wrote:
> > Unless I really screwed up a merge in a strange way, the
> > ieee80211_scan_work is broken.
> >
> > It calls mutex_unlock(&local->mtx) too many times when it hits
> > this code:
> >
> > case SCAN_DECISION:
> > /* if no more bands/channels left, complete scan */
> > if (local->scan_channel_idx >= local->scan_req->n_channels) {
> > aborted = false;
> > goto out_complete;
> > }
>
> So much for trusting Stanislaw :-( I can reproduce this in hwsim.
> Stanislaw, did you ever test software scan at all?
No, sorry.
> Below patch fixes this.
>
> johannes
>
> ---
> net/mac80211/scan.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> --- wireless-testing.orig/net/mac80211/scan.c 2010-10-07 10:27:37.000000000 +0200
> +++ wireless-testing/net/mac80211/scan.c 2010-10-07 10:31:19.000000000 +0200
> @@ -693,8 +693,6 @@ void ieee80211_scan_work(struct work_str
> goto out_complete;
> }
>
> - mutex_unlock(&local->mtx);
> -
> /*
> * as long as no delay is required advance immediately
> * without scheduling a new work
> @@ -725,6 +723,7 @@ void ieee80211_scan_work(struct work_str
> } while (next_delay == 0);
>
> ieee80211_queue_delayed_work(&local->hw, &local->scan_work, next_delay);
> + mutex_unlock(&local->mtx);
> return;
>
> out_complete:
We never keep locking inside do { } while (next_delay == 0) loop,
perhaps below patch is something better:
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 2c79b83..615a831 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -693,6 +693,7 @@ void ieee80211_scan_work(struct work_struct *work)
case SCAN_DECISION:
/* if no more bands/channels left, complete scan */
if (local->scan_channel_idx >= local->scan_req->n_channels) {
+ mutex_lock(&local->mtx);
aborted = false;
goto out_complete;
}
If so, I will post it officially shortly, if not please proceed
with your patch.
Sorry again
Stanislaw
next prev parent reply other threads:[~2010-10-07 9:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-07 4:13 Latest wireless-testing has broken scan locking Ben Greear
2010-10-07 8:34 ` Johannes Berg
2010-10-07 9:18 ` Stanislaw Gruszka [this message]
2010-10-07 9:24 ` Johannes Berg
2010-10-07 9:38 ` Stanislaw Gruszka
2010-10-07 9:38 ` 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=20101007091839.GC2435@redhat.com \
--to=sgruszka@redhat.com \
--cc=greearb@candelatech.com \
--cc=johannes@sipsolutions.net \
--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).