On Sat, May 14, 2011 at 2:20 AM, Johannes Berg <johannes@xxxxxxxxxxxxxxxx> wrote: > On Sat, 2011-05-14 at 11:00 +0200, Johannes Berg wrote: >> From: Johannes Berg <johannes.berg@xxxxxxxxx> >> >> The locking in mesh_{mpath,mpp}_table_grow not only >> has an rcu_read_unlock() missing, it's also racy >> (though really only technically since it's invoked >> from a single function only) since it obtains the >> new size of the table without any locking, so two >> invocations of the function could attempt the same >> resize. > > Actually, it _can_ happen, if you have multiple mesh interfaces. I'm seeing this after trying your patch, probably because the allocations mesh_table_alloc() can block. In the past I had tried to allocate the table before entering the critical section. If that is not possible for the race condition you mention, then I guess we'll have to make those allocations GFP_ATOMIC? 363.767523] BUG: scheduling while atomic: kworker/u:2/621/0x10000200 [ 363.768239] 3 locks held by kworker/u:2/621: [ 363.768516] #0: (name){.+.+.+}, at: [<c10429e7>] process_one_work+0x17c/0x31d [ 363.769605] #1: ((&sdata->work)){+.+.+.}, at: [<c10429e7>] process_one_work+0x17c/0x31d [ 363.770149] #2: (pathtbl_resize_lock){++.-+.}, at: [<c8fb01ce>] mesh_mpath_table_grow+0xf/0x5c [mac80211] [ 363.771122] Modules linked in: mac80211_hwsim mac80211 [ 363.771824] Pid: 621, comm: kworker/u:2 Not tainted 2.6.39-rc7-wl+ #399 [ 363.772304] Call Trace: [ 363.772611] [<c8faf69f>] ? mesh_table_alloc+0x25/0xc2 [mac80211] [ 363.772969] [<c102c049>] __schedule_bug+0x5e/0x65 [ 363.773350] [<c14672af>] schedule+0x68/0x699 [ 363.773608] [<c1058328>] ? __lock_acquire+0xab3/0xb59 [ 363.773900] [<c105694e>] ? valid_state+0x1a/0x13d [ 363.774244] [<c1056c10>] ? mark_lock+0x19f/0x1d9 [ 363.774527] [<c105720b>] ? check_usage_forwards+0x68/0x68 [ 363.774873] [<c1056c8d>] ? mark_held_locks+0x43/0x5b [ 363.775303] [<c8faf69f>] ? mesh_table_alloc+0x25/0xc2 [mac80211] [ 363.775654] [<c102e544>] __cond_resched+0x16/0x26 [ 363.775918] [<c1467a92>] _cond_resched+0x1d/0x28 Javier -- Javier Cardona cozybit Inc. http://www.cozybit.com -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html