Bug 17311

Summary: 2.6.36-rc2-git4 - INFO: possible circular locking dependency detected
Product: Drivers Reporter: Maciej Rutecki (maciej.rutecki)
Component: network-wirelessAssignee: John W. Linville (linville)
Status: CLOSED CODE_FIX    
Severity: normal CC: linville, maciej.rutecki, miles.lane, rjw
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.36-rc2-git4 Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 16444    
Attachments: 0001-wireless-register-wiphy-rfkill-w-o-holding-cfg80211_.patch
0001-wireless-register-wiphy-rfkill-w-o-holding-cfg80211_.patch

Description Maciej Rutecki 2010-08-29 13:52:26 UTC
Subject    : 2.6.36-rc2-git4 - INFO: possible circular locking dependency detected
Submitter  : Miles Lane <miles.lane@gmail.com>
Date       : 2010-08-27 1:56
Message-ID : AANLkTinHbEW36D5R9NSrGgfbOC0Hri3Tg-fA0iR92Udi@mail.gmail.com
References : http://marc.info/?l=linux-kernel&m=128287422106267&w=2

This entry is being used for tracking a regression from 2.6.35. Please don't
close it until the problem is fixed in the mainline.

Caused by:

commit 5a652052fedbd7869572c757dd2ffc2ed420c69d
Author: Maxime Bizon <mbizon@freebox.fr>
Date:   Wed Jul 21 17:21:38 2010 +0200

    cfg80211: fix race between sysfs and cfg80211

First-Bad-Commit : 5a652052fedbd7869572c757dd2ffc2ed420c69d
Comment 1 Rafael J. Wysocki 2010-08-29 22:34:55 UTC
Handled-By : Johannes Berg <johannes@sipsolutions.net>
Comment 2 John W. Linville 2010-08-30 21:38:46 UTC
Created attachment 28571 [details]
0001-wireless-register-wiphy-rfkill-w-o-holding-cfg80211_.patch
Comment 3 John W. Linville 2010-08-30 22:39:02 UTC
Miles, can you attempt to recreate this issue with the patch above?
Comment 4 John W. Linville 2010-08-31 18:44:32 UTC
Created attachment 28671 [details]
0001-wireless-register-wiphy-rfkill-w-o-holding-cfg80211_.patch
Comment 5 John W. Linville 2010-09-15 18:14:30 UTC
commit c3d34d5d9654ec9c2510f9341bfb1030b8f029d1
Author: John W. Linville <linville@tuxdriver.com>
Date:   Mon Aug 30 17:36:40 2010 -0400

    wireless: register wiphy rfkill w/o holding cfg80211_mutex
    
    Otherwise lockdep complains...
    
    https://bugzilla.kernel.org/show_bug.cgi?id=17311
    
    [ INFO: possible circular locking dependency detected ]
    2.6.36-rc2-git4 #12
    -------------------------------------------------------
    kworker/0:3/3630 is trying to acquire lock:
     (rtnl_mutex){+.+.+.}, at: [<ffffffff813396c7>] rtnl_lock+0x12/0x14
    
    but task is already holding lock:
     (rfkill_global_mutex){+.+.+.}, at: [<ffffffffa014b129>]
    rfkill_switch_all+0x24/0x49 [rfkill]
    
    which lock already depends on the new lock.
    
    the existing dependency chain (in reverse order) is:
    
    -> #2 (rfkill_global_mutex){+.+.+.}:
           [<ffffffff81079ad7>] lock_acquire+0x120/0x15b
           [<ffffffff813ae869>] __mutex_lock_common+0x54/0x52e
           [<ffffffff813aede9>] mutex_lock_nested+0x34/0x39
           [<ffffffffa014b4ab>] rfkill_register+0x2b/0x29c [rfkill]
           [<ffffffffa0185ba0>] wiphy_register+0x1ae/0x270 [cfg80211]
           [<ffffffffa0206f01>] ieee80211_register_hw+0x1b4/0x3cf [mac80211]
           [<ffffffffa0292e98>] iwl_ucode_callback+0x9e9/0xae3 [iwlagn]
           [<ffffffff812d3e9d>] request_firmware_work_func+0x54/0x6f
           [<ffffffff81065d15>] kthread+0x8c/0x94
           [<ffffffff8100ac24>] kernel_thread_helper+0x4/0x10
    
    -> #1 (cfg80211_mutex){+.+.+.}:
           [<ffffffff81079ad7>] lock_acquire+0x120/0x15b
           [<ffffffff813ae869>] __mutex_lock_common+0x54/0x52e
           [<ffffffff813aede9>] mutex_lock_nested+0x34/0x39
           [<ffffffffa018605e>] cfg80211_get_dev_from_ifindex+0x1b/0x7c [cfg80211]
           [<ffffffffa0189f36>] cfg80211_wext_giwscan+0x58/0x990 [cfg80211]
           [<ffffffff8139a3ce>] ioctl_standard_iw_point+0x1a8/0x272
           [<ffffffff8139a529>] ioctl_standard_call+0x91/0xa7
           [<ffffffff8139a687>] T.723+0xbd/0x12c
           [<ffffffff8139a727>] wext_handle_ioctl+0x31/0x6d
           [<ffffffff8133014e>] dev_ioctl+0x63d/0x67a
           [<ffffffff8131afd9>] sock_ioctl+0x48/0x21d
           [<ffffffff81102abd>] do_vfs_ioctl+0x4ba/0x509
           [<ffffffff81102b5d>] sys_ioctl+0x51/0x74
           [<ffffffff81009e02>] system_call_fastpath+0x16/0x1b
    
    -> #0 (rtnl_mutex){+.+.+.}:
           [<ffffffff810796b0>] __lock_acquire+0xa93/0xd9a
           [<ffffffff81079ad7>] lock_acquire+0x120/0x15b
           [<ffffffff813ae869>] __mutex_lock_common+0x54/0x52e
           [<ffffffff813aede9>] mutex_lock_nested+0x34/0x39
           [<ffffffff813396c7>] rtnl_lock+0x12/0x14
           [<ffffffffa0185cb5>] cfg80211_rfkill_set_block+0x1a/0x7b [cfg80211]
           [<ffffffffa014aed0>] rfkill_set_block+0x80/0xd5 [rfkill]
           [<ffffffffa014b07e>] __rfkill_switch_all+0x3f/0x6f [rfkill]
           [<ffffffffa014b13d>] rfkill_switch_all+0x38/0x49 [rfkill]
           [<ffffffffa014b821>] rfkill_op_handler+0x105/0x136 [rfkill]
           [<ffffffff81060708>] process_one_work+0x248/0x403
           [<ffffffff81062620>] worker_thread+0x139/0x214
           [<ffffffff81065d15>] kthread+0x8c/0x94
           [<ffffffff8100ac24>] kernel_thread_helper+0x4/0x10
    
    Signed-off-by: John W. Linville <linville@tuxdriver.com>
    Acked-by: Johannes Berg <johannes@sipsolutions.net>