linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Wey-Yi Guy <wey-yi.w.guy@intel.com>,
	Reinette Chatre <reinette.chatre@intel.com>,
	"John W. Linville" <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org
Subject: Re: [RFC] iwlwifi: rewrite iwl-scan.c to avoid race conditions
Date: Thu, 26 Aug 2010 14:21:36 +0200	[thread overview]
Message-ID: <1282825296.3812.25.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <20100826120359.GA21646@redhat.com>

On Thu, 2010-08-26 at 14:03 +0200, Stanislaw Gruszka wrote:

> > Since we've had locking problems in such situations a lot, I'm just
> > going to allow mac80211 to call scan_completed() from any context.
> > That'll get rid of all the problems with the mutx here, so that you can
> > move this code into a helper function (based on your description, I
> > suspect I'll see it again in the patch)
> 
> This is mutex recursion problem, scan_completed() call
> ieee80211_hw_config() -> iwl_mac_config() -> mutex_lock(&priv->mutex).
> I should put short comment about that. Even on possibly removal
> of ieee80211_hw_config (for example when aborted==true) we still
> can have possible deadlock, because of mac80211 local->mtx and
> iwlwifi priv->mutex locking ordering.

Yeah, but I see you found my other patch now, which makes
ieee80211_scan_completed() really callable everywhere :)

> > > +				if (priv->is_internal_short_scan &&
> > > +				    priv->scan_request == NULL)
> > > +					ret = 0;
> > 
> > Is that && really correct? It's just an extra check, right? I mean,
> > scan_request is always NULL for internal short scans...
> Nope, your commit f84b29ec0a1ab767679d3f2428877b65f94bc3ff changed
> that :-)

D'oh! You're right.

> > Hmm, an only tangentially related question: do we really need to do all
> > these atomic bit operations? We hold the mutex everywhere anyway, no?
> 
> No. This my way to write things in one line instead of two, but perhaps
> two lines version should be used to not confuse readers.

No, I wasn't thinking of set_bit/clear_bit etc. but rather using bool
values... Don't worry about that though, I'll go through at some point
and check all the status bits.

> > > +	if (test_bit(STATUS_SCAN_HW, &priv->status)) {
> > > +		/* just live w/ bad key and rely briefly on SW decryption */
> > >  		return;
> > >  	}
> > > +	/* XXX: race condition: nothing prevent to start HW scanning now */
> > 
> > TBH, I don't even understand why we need to cancel the scan here. We're
> > just updating a key ... and we don't really do that while scanning
> > anyway since it's triggered only by receiving frames successfully...
> 
> I don't understand this also.

It's probably some hw requirement that failed to make it into a
comment ... Wey-yi?

johannes


      reply	other threads:[~2010-08-26 12:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-20 13:32 [RFC] iwlwifi: rewrite iwl-scan.c to avoid race conditions Stanislaw Gruszka
2010-08-26 11:06 ` Johannes Berg
2010-08-26 12:03   ` Stanislaw Gruszka
2010-08-26 12:21     ` Johannes Berg [this message]

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=1282825296.3812.25.camel@jlt3.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=reinette.chatre@intel.com \
    --cc=sgruszka@redhat.com \
    --cc=wey-yi.w.guy@intel.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 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).