linux-kernel-test/drivers/net/wireless
Herton Ronaldo Krzesinski 6a8171f261 rtl8187: fix circular locking (rtl8187_stop/rtl8187_work)
Larry Finger reports following lockdep warning:

[ INFO: possible circular locking dependency detected ]
2.6.31-rc6-wl #201
-------------------------------------------------------
rfkill/30578 is trying to acquire lock:
 (&(&priv->work)->work#2){+.+...}, at: [<ffffffff81051215>]
__cancel_work_timer+0xd9/0x222

but task is already holding lock:
 (&priv->conf_mutex#2){+.+.+.}, at: [<ffffffffa064a024>]
rtl8187_stop+0x31/0x364 [rtl8187]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #1 (&priv->conf_mutex#2){+.+.+.}:
       [<ffffffff81065957>] __lock_acquire+0x12d0/0x1614
       [<ffffffff81065d54>] lock_acquire+0xb9/0xdd
       [<ffffffff8127c32f>] mutex_lock_nested+0x56/0x2a8
       [<ffffffffa064a392>] rtl8187_work+0x3b/0xf2 [rtl8187]
       [<ffffffff81050758>] worker_thread+0x1fa/0x30a
       [<ffffffff81054ca5>] kthread+0x8f/0x97
       [<ffffffff8100cb7a>] child_rip+0xa/0x20
       [<ffffffffffffffff>] 0xffffffffffffffff

-> #0 (&(&priv->work)->work#2){+.+...}:
       [<ffffffff8106568c>] __lock_acquire+0x1005/0x1614
       [<ffffffff81065d54>] lock_acquire+0xb9/0xdd
       [<ffffffff8105124e>] __cancel_work_timer+0x112/0x222
       [<ffffffff8105136b>] cancel_delayed_work_sync+0xd/0xf
       [<ffffffffa064a33f>] rtl8187_stop+0x34c/0x364 [rtl8187]
       [<ffffffffa0242866>] ieee80211_stop_device+0x29/0x61 [mac80211]
       [<ffffffffa0239194>] ieee80211_stop+0x476/0x530 [mac80211]
       [<ffffffff8120ce15>] dev_close+0x8a/0xac
       [<ffffffffa01d9fa7>] cfg80211_rfkill_set_block+0x4a/0x7a [cfg80211]
       [<ffffffffa01bf4f0>] rfkill_set_block+0x84/0xd9 [rfkill]
       [<ffffffffa01bfc31>] rfkill_fop_write+0xda/0x124 [rfkill]
       [<ffffffff810cf286>] vfs_write+0xae/0x14a
       [<ffffffff810cf3e6>] sys_write+0x47/0x6e
       [<ffffffff8100ba6b>] system_call_fastpath+0x16/0x1b
       [<ffffffffffffffff>] 0xffffffffffffffff

The problem here is that rtl8187_stop, while helding priv->conf_mutex,
runs cancel_delayed_work_sync on an workqueue that runs rtl8187_work,
which also takes priv->conf_mutex lock. Move cancel_delayed_work_sync
out of rtl8187_stop priv->conf_mutex locking region.

Reported-by: Larry Finger <Larry.Finger@lwfinger.net>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-08-28 14:40:51 -04:00
..
ath ath9k: Add Bluetooth Coexistence 3-wire support 2009-08-28 14:40:51 -04:00
b43 b43: LP-PHY: Fix a few typos in the RC calibration code 2009-08-28 14:40:45 -04:00
b43legacy mac80211: allow configure_filter callback to sleep 2009-08-20 11:35:58 -04:00
hostap
ipw2x00 libipw: initiate cfg80211 API conversion 2009-08-28 14:40:46 -04:00
iwlwifi iwlwifi: fix unloading driver while scanning 2009-08-28 14:40:39 -04:00
iwmc3200wifi
libertas libertas: Add support for Marvell Libertas CF8305 2009-08-28 14:40:35 -04:00
libertas_tf mac80211: allow configure_filter callback to sleep 2009-08-20 11:35:58 -04:00
orinoco orinoco: remove spare whitespace 2009-08-20 11:36:07 -04:00
p54 p54: fix broadcast buffering in AP mode 2009-08-28 14:40:23 -04:00
prism54 PRISM54: fix compilation warning 2009-08-28 14:40:44 -04:00
rt2x00 rt2x00: bss_info_changed() callback is allowed to sleep 2009-08-20 11:36:05 -04:00
rtl818x rtl8187: fix circular locking (rtl8187_stop/rtl8187_work) 2009-08-28 14:40:51 -04:00
wl12xx wl1271: remove print_mac usage 2009-08-20 11:36:03 -04:00
zd1211rw mac80211: allow configure_filter callback to sleep 2009-08-20 11:35:58 -04:00
adm8211.c mac80211: allow configure_filter callback to sleep 2009-08-20 11:35:58 -04:00
adm8211.h
airo_cs.c
airo.c
airo.h
arlan-main.c
arlan-proc.c
arlan.h
at76c50x-usb.c mac80211: remove deprecated API 2009-08-20 11:35:58 -04:00
at76c50x-usb.h
atmel_cs.c
atmel_pci.c
atmel.c
atmel.h
i82586.h
i82593.h
Kconfig
mac80211_hwsim.c mac80211: allow configure_filter callback to sleep 2009-08-20 11:35:58 -04:00
Makefile
mwl8k.c mwl8k: separate driver and device info reporting during probe 2009-08-28 14:40:42 -04:00
netwave_cs.c
ray_cs.c
ray_cs.h
rayctl.h
rndis_wlan.c rndis_wlan: set cipher suites for cfg80211 2009-08-28 14:40:48 -04:00
strip.c
wavelan_cs.c
wavelan_cs.h
wavelan_cs.p.h
wavelan.c
wavelan.h
wavelan.p.h
wl3501_cs.c
wl3501.h
zd1201.c
zd1201.h