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
..
2009-08-13 16:26:13 -07:00
2009-08-13 16:43:32 -07:00
2009-08-05 20:28:27 -07:00
2009-08-26 15:29:21 -07:00
2009-08-14 09:14:04 -04:00
2009-08-05 13:10:46 -07:00
2009-08-13 16:26:10 -07:00
2008-12-08 01:14:16 -08:00
2009-05-26 20:35:02 -07:00
2008-11-25 18:12:49 -08:00
2009-04-24 04:45:33 -07:00
2009-05-29 01:46:27 -07:00
2008-11-25 18:25:32 -08:00
2009-08-02 12:54:18 -07:00
2009-04-04 16:51:14 -07:00
2009-08-22 17:48:55 -07:00
2009-08-12 23:03:00 -07:00
2009-08-12 22:53:28 -07:00
2009-08-12 23:03:01 -07:00
2009-08-12 23:03:02 -07:00
2009-08-12 23:03:01 -07:00
2009-08-12 23:03:01 -07:00
2009-08-05 12:22:11 -07:00
2009-07-23 18:01:01 -07:00
2009-07-06 18:54:51 -07:00
2008-11-25 18:23:59 -08:00
2009-07-27 11:35:28 -07:00
2009-07-05 18:03:33 -07:00
2009-02-04 16:43:44 -08:00
2009-02-26 21:02:19 -08:00
2008-11-25 18:24:57 -08:00
2009-04-16 02:20:08 -07:00
2009-01-06 10:47:44 -08:00
2009-07-06 13:05:11 -07:00
2009-07-06 13:05:13 -07:00
2009-06-08 00:20:20 -07:00
2009-07-20 08:23:26 -07:00
2009-07-20 08:23:26 -07:00
2008-11-25 18:24:38 -08:00
2009-04-16 02:20:16 -07:00
2009-06-25 20:06:34 -07:00
2009-04-16 02:20:21 -07:00
2009-08-12 21:54:53 -07:00
2009-07-16 09:14:23 -07:00
2008-11-10 15:11:56 -05:00
2009-08-12 22:13:23 -07:00
2009-04-29 17:32:34 -07:00
2009-08-02 12:20:40 -07:00
2009-05-25 22:49:56 -07:00
2009-08-18 20:26:54 -07:00
2009-08-18 20:26:53 -07:00
2009-03-27 00:46:48 -07:00
2008-11-25 18:25:49 -08:00
2009-07-12 14:20:04 -07:00
2009-08-26 15:48:08 -07:00
2009-08-26 15:48:00 -07:00
2009-07-23 18:01:02 -07:00
2009-01-11 00:06:36 -08:00