From: Johannes Berg Date: Sat, 12 Sep 2009 03:03:15 +0000 (+0000) Subject: genetlink: fix netns vs. netlink table locking X-Git-Tag: v2.6.32-rc1~657^2~47 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d136f1bd366fdb7e747ca7e0218171e7a00a98a5;p=pandora-kernel.git genetlink: fix netns vs. netlink table locking Since my commits introducing netns awareness into genetlink we can get this problem: BUG: scheduling while atomic: modprobe/1178/0x00000002 2 locks held by modprobe/1178: #0: (genl_mutex){+.+.+.}, at: [] genl_register_mc_grou #1: (rcu_read_lock){.+.+..}, at: [] genl_register_mc_g Pid: 1178, comm: modprobe Not tainted 2.6.31-rc8-wl-34789-g95cb731-dirty # Call Trace: [] __schedule_bug+0x85/0x90 [] schedule+0x108/0x588 [] netlink_table_grab+0xa1/0xf0 [] netlink_change_ngroups+0x47/0x100 [] genl_register_mc_group+0x12f/0x290 because I overlooked that netlink_table_grab() will schedule, thinking it was just the rwlock. However, in the contention case, that isn't actually true. Fix this by letting the code grab the netlink table lock first and then the RCU for netns protection. Signed-off-by: Johannes Berg Signed-off-by: David S. Miller --- Reading git-diff-tree failed