Bug 13312 - at76c50x-usb mutex deadlock
Summary: at76c50x-usb mutex deadlock
Status: CLOSED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: network-wireless (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: drivers_network-wireless@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-14 20:54 UTC by karlrelton000+ubuntu
Modified: 2010-03-05 18:40 UTC (History)
2 users (show)

See Also:
Kernel Version: 2.6.30-rc5
Subsystem:
Regression: No
Bisected commit-id:


Attachments
0001-at76c50x-usb-avoid-mutex-deadlock-in-at76_dwork_hw_.patch (1.44 KB, patch)
2009-05-28 09:47 UTC, John W. Linville
Details | Diff

Description karlrelton000+ubuntu 2009-05-14 20:54:53 UTC
at76_dwork_hw_scan() does a mutex_lock and then calls ieee80211_scan_completed(). This in turn calls at76_config() which then tries to do the same mutex_lock and thus the driver goes into deadlock.

I believe the solution would be for at76_dwork_hw_scan() to unlock the mutex before calling ieee80211_scan_completed(). I've tried this with my card, and it does indeed avoid the lockup - though I have yet to get the card working properly with this driver.
Comment 1 Andrew Morton 2009-05-28 07:49:30 UTC
(switched to email.  Please respond via emailed reply-to-all, not via the
bugzilla web interface).

On Thu, 14 May 2009 20:54:54 GMT bugzilla-daemon@bugzilla.kernel.org wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=13312
> 
>            Summary: at76c50x-usb mutex deadlock
>            Product: Drivers
>            Version: 2.5
>     Kernel Version: 2.6.30-rc5
>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: network-wireless
>         AssignedTo: drivers_network-wireless@kernel-bugs.osdl.org
>         ReportedBy: karllinuxtest.relton@ntlworld.com
>                 CC: kalle.valo@iki.fi
>         Regression: No
> 
> 
> at76_dwork_hw_scan() does a mutex_lock and then calls
> ieee80211_scan_completed(). This in turn calls at76_config() which then tries
> to do the same mutex_lock and thus the driver goes into deadlock.
> 
> I believe the solution would be for at76_dwork_hw_scan() to unlock the mutex
> before calling ieee80211_scan_completed(). I've tried this with my card, and
> it
> does indeed avoid the lockup - though I have yet to get the card working
> properly with this driver.
> 

umm, is anyone looking at
drivers_network-wireless@kernel-bugs.osdl.org?  This one seems a bit of
a no-brainer?
Comment 2 John W. Linville 2009-05-28 09:47:11 UTC
Created attachment 21599 [details]
0001-at76c50x-usb-avoid-mutex-deadlock-in-at76_dwork_hw_.patch

Would you mind trying this patch?
Comment 3 karlrelton000+ubuntu 2009-05-31 17:53:27 UTC
The patch does resolve the mutex lockup.
Comment 4 John W. Linville 2010-03-05 18:40:31 UTC
commit 21a4cc00e8e67edcfc1bdb9af6d370ed1226eb86
Author: John W. Linville <linville@tuxdriver.com>
Date:   Thu May 28 11:39:02 2009 +0200

    at76c50x-usb: avoid mutex deadlock in at76_dwork_hw_scan
    
    http://bugzilla.kernel.org/show_bug.cgi?id=13312
    
    at76_dwork_hw_scan holds a mutex while calling ieee80211_scan_completed,
    which then calls at76_config which needs the same mutex.  This reworks
    the ordering to not hold the lock while calling ieee80211_scan_completed.
    
    Signed-off-by: John W. Linville <linville@tuxdriver.com>

Note You need to log in before you can comment on or make changes to this bug.