netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: Michael Buesch <mb@bu3sch.de>
Cc: Ulrich Kunitz <kune@deine-taler.de>,
	netdev@vger.kernel.org, Bcm43xx-dev@lists.berlios.de,
	Stefano Brivio <st3@riseup.net>,
	John Linville <linville@tuxdriver.com>
Subject: Re: [PATCH] softmac: Fixed handling of deassociation from AP
Date: Wed, 06 Dec 2006 18:36:56 -0600	[thread overview]
Message-ID: <45776228.2050005@lwfinger.net> (raw)
In-Reply-To: <200612062351.07016.mb@bu3sch.de>

Michael Buesch wrote:
> On Wednesday 06 December 2006 22:51, Ulrich Kunitz wrote:
>> On 06-12-06 21:52 Michael Buesch wrote:
>>
>>> On Wednesday 06 December 2006 21:17, Ulrich Kunitz wrote:
>>>> On 06-12-06 18:52 Michael Buesch wrote:
>>>>
>>>>> All data in mac->associnfo is protected by mac->associnfo->mutex
>>>>> and _not_ mac->lock.
>>>> Are you sure?
>>> Yes I am.
>>>
>>>> One can find for instance the following function in 
>>>> ieee80211softmac_assoc.c:
>>> This is not the first time we notice that locking
>>> is completely broken in softmac. ;)
>> So the right thing would be to add another work function
>> (*_start_reassoc_work) which sets the associating variable and
>> calls then *_assoc_work? 
> 
> Ah, well. I think the right thing doesn't exist.
> Even if you replace the lock by the mutex, it's still racy.
> The whole lock design of softmac is broken and racy and we
> can't simply fix that with a oneliner.
> 
> I'd say, John, apply the original patch as-is, as it does
> more good than harm.
> 
> Basically, I just wanted to point out that this is not race-free.
> But I think we can live with it.

In struct ieee80211softmac_device, there are the following entries:
...
	spinlock_t lock;

         u8 running; /* SoftMAC started? */
         u8 scanning;

         struct ieee80211softmac_scaninfo *scaninfo;
         struct ieee80211softmac_assoc_info associnfo;
         struct ieee80211softmac_bss_info bssinfo;
...

In struct ieee80211softmac_assoc_info, we have the following entries:

         struct mutex mutex;
         struct ieee80211softmac_essid associate_essid;
         char bssid[ETH_ALEN];
         u8 static_essid;
         u8 short_preamble_available;
         u8 associating;
         u8 associated;
         u8 assoc_wait;
         u8 bssvalid;
         u8 bssfixed;

Although it has been amply demonstrated in this forum that I know nothing about locking, it seems to 
me that the mutex protects only the association data; whereas the spinlock protects more data, but 
does include the association data. If this is correct, then the original posted code is not wrong, 
only protecting data unnecessarily.

Please point out the error in my logic. I'm trying to learn.

Larry



  reply	other threads:[~2006-12-07  0:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-06 14:45 [PATCH] softmac: Fixed handling of deassociation from AP Larry Finger
2006-12-06 17:52 ` Michael Buesch
2006-12-06 20:17   ` Ulrich Kunitz
2006-12-06 20:52     ` Michael Buesch
2006-12-06 21:51       ` Ulrich Kunitz
2006-12-06 22:51         ` Michael Buesch
2006-12-07  0:36           ` Larry Finger [this message]
     [not found]             ` <45776228.2050005-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
2006-12-07  9:50               ` Michael Buesch
  -- strict thread matches above, loose matches on Subject: below --
2006-12-03 15:32 Ulrich Kunitz

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=45776228.2050005@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=Bcm43xx-dev@lists.berlios.de \
    --cc=kune@deine-taler.de \
    --cc=linville@tuxdriver.com \
    --cc=mb@bu3sch.de \
    --cc=netdev@vger.kernel.org \
    --cc=st3@riseup.net \
    /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).