Amerigo Wang
8965779d2c
ipv6,mcast: always hold idev->lock before mca_lock
dingtianhong reported the following deadlock detected by lockdep:
======================================================
[ INFO: possible circular locking dependency detected ]
3.4.24.05-0.1-default #1 Not tainted
-------------------------------------------------------
ksoftirqd/0/3 is trying to acquire lock:
(&ndev->lock){+.+...}, at: [<ffffffff8147f804>] ipv6_get_lladdr+0x74/0x120
but task is already holding lock:
(&mc->mca_lock){+.+...}, at: [<ffffffff8149d130>] mld_send_report+0x40/0x150
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&mc->mca_lock){+.+...}:
[<ffffffff810a8027>] validate_chain+0x637/0x730
[<ffffffff810a8417>] __lock_acquire+0x2f7/0x500
[<ffffffff810a8734>] lock_acquire+0x114/0x150
[<ffffffff814f691a>] rt_spin_lock+0x4a/0x60
[<ffffffff8149e4bb>] igmp6_group_added+0x3b/0x120
[<ffffffff8149e5d8>] ipv6_mc_up+0x38/0x60
[<ffffffff81480a4d>] ipv6_find_idev+0x3d/0x80
[<ffffffff81483175>] addrconf_notify+0x3d5/0x4b0
[<ffffffff814fae3f>] notifier_call_chain+0x3f/0x80
[<ffffffff81073471>] raw_notifier_call_chain+0x11/0x20
[<ffffffff813d8722>] call_netdevice_notifiers+0x32/0x60
[<ffffffff813d92d4>] __dev_notify_flags+0x34/0x80
[<ffffffff813d9360>] dev_change_flags+0x40/0x70
[<ffffffff813ea627>] do_setlink+0x237/0x8a0
[<ffffffff813ebb6c>] rtnl_newlink+0x3ec/0x600
[<ffffffff813eb4d0>] rtnetlink_rcv_msg+0x160/0x310
[<ffffffff814040b9>] netlink_rcv_skb+0x89/0xb0
[<ffffffff813eb357>] rtnetlink_rcv+0x27/0x40
[<ffffffff81403e20>] netlink_unicast+0x140/0x180
[<ffffffff81404a9e>] netlink_sendmsg+0x33e/0x380
[<ffffffff813c4252>] sock_sendmsg+0x112/0x130
[<ffffffff813c537e>] __sys_sendmsg+0x44e/0x460
[<ffffffff813c5544>] sys_sendmsg+0x44/0x70
[<ffffffff814feab9>] system_call_fastpath+0x16/0x1b
-> #0 (&ndev->lock){+.+...}:
[<ffffffff810a798e>] check_prev_add+0x3de/0x440
[<ffffffff810a8027>] validate_chain+0x637/0x730
[<ffffffff810a8417>] __lock_acquire+0x2f7/0x500
[<ffffffff810a8734>] lock_acquire+0x114/0x150
[<ffffffff814f6c82>] rt_read_lock+0x42/0x60
[<ffffffff8147f804>] ipv6_get_lladdr+0x74/0x120
[<ffffffff8149b036>] mld_newpack+0xb6/0x160
[<ffffffff8149b18b>] add_grhead+0xab/0xc0
[<ffffffff8149d03b>] add_grec+0x3ab/0x460
[<ffffffff8149d14a>] mld_send_report+0x5a/0x150
[<ffffffff8149f99e>] igmp6_timer_handler+0x4e/0xb0
[<ffffffff8105705a>] call_timer_fn+0xca/0x1d0
[<ffffffff81057b9f>] run_timer_softirq+0x1df/0x2e0
[<ffffffff8104e8c7>] handle_pending_softirqs+0xf7/0x1f0
[<ffffffff8104ea3b>] __do_softirq_common+0x7b/0xf0
[<ffffffff8104f07f>] __thread_do_softirq+0x1af/0x210
[<ffffffff8104f1c1>] run_ksoftirqd+0xe1/0x1f0
[<ffffffff8106c7de>] kthread+0xae/0xc0
[<ffffffff814fff74>] kernel_thread_helper+0x4/0x10
actually we can just hold idev->lock before taking pmc->mca_lock,
and avoid taking idev->lock again when iterating idev->addr_list,
since the upper callers of mld_newpack() already take
read_lock_bh(&idev->lock).
Reported-by: dingtianhong <dingtianhong@huawei.com>
Cc: dingtianhong <dingtianhong@huawei.com>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Tested-by: Ding Tianhong <dingtianhong@huawei.com>
Tested-by: Chen Weilong <chenweilong@huawei.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-07-01 23:39:21 -07:00
..
2013-02-27 22:51:08 -05:00
2013-06-23 00:23:53 +01:00
2013-04-23 13:25:51 -04:00
2013-04-19 17:32:31 -04:00
2013-04-08 17:16:57 -04:00
2013-06-11 02:51:03 -07:00
2013-05-23 14:23:16 +02:00
2013-06-14 13:44:58 +02:00
2012-06-17 16:29:38 -07:00
2013-07-01 23:22:13 -07:00
2010-08-20 01:42:59 -07:00
2013-06-11 02:51:03 -07:00
2013-07-01 23:39:21 -07:00
2009-08-12 21:54:50 -07:00
2011-04-24 10:54:56 -07:00
2013-05-01 15:13:49 -04:00
2011-01-13 21:48:25 -08:00
2012-08-09 16:18:06 -07:00
2011-11-30 18:51:03 -05:00
2013-02-27 19:10:24 -08:00
2009-03-24 23:32:03 -07:00
2011-08-08 14:26:29 -04:00
2013-06-19 18:55:39 +02:00
2012-08-30 03:00:16 +02:00
2012-06-01 14:18:29 -04:00
2013-04-09 13:19:35 -04:00
2012-08-10 16:52:54 -07:00
2012-04-15 12:44:40 -04:00
2011-10-06 15:49:51 -04:00
2012-04-05 05:08:04 -04:00
2010-11-08 13:50:08 -08:00
2013-03-22 10:31:16 -04:00
2010-06-03 03:21:52 -07:00
2013-01-28 00:15:27 -05:00
2012-04-15 12:44:40 -04:00
2011-12-01 11:41:06 -05:00
2013-01-09 23:59:53 -08:00
2012-07-19 10:43:03 -07:00
2013-03-15 09:06:58 -04:00
2008-01-31 19:27:02 -08:00
2009-03-27 00:16:21 -07:00
2012-06-29 01:36:36 -07:00
2013-03-26 12:32:13 -04:00
2013-03-20 12:14:36 -04:00
2012-10-08 17:42:36 -04:00
2011-05-12 17:46:56 -04:00
2013-06-11 02:51:03 -07:00
2013-04-25 01:43:15 -04:00
2013-06-19 18:07:41 -07:00
2013-01-27 22:46:33 -05:00
2013-02-22 15:10:18 -05:00
2013-05-24 12:07:25 +02:00
2013-04-08 12:00:16 -04:00
2011-11-14 00:19:42 -05:00
2013-06-28 21:19:17 -07:00
2012-07-16 03:44:56 -07:00
2013-02-21 18:15:58 -05:00
2012-07-19 11:02:03 -07:00
2013-03-12 08:30:34 -04:00
2013-05-28 23:49:07 -07:00
2013-05-06 11:06:51 -04:00
2013-02-27 19:10:24 -08:00
2013-06-12 03:13:50 -07:00
2013-02-27 19:10:24 -08:00
2012-07-10 22:40:14 -07:00
2013-01-08 17:56:10 -08:00
2013-02-20 15:11:45 -05:00
2013-01-18 14:41:13 -05:00
2013-03-26 12:27:18 -04:00
2013-06-28 21:27:47 -07:00
2013-06-27 22:30:47 -07:00
2013-06-26 18:01:46 +09:00
2013-01-21 14:17:05 -05:00
2010-02-16 23:05:38 -08:00
2008-06-11 21:00:38 -07:00
2013-06-19 23:18:07 -07:00
2011-04-24 10:54:56 -07:00
2011-03-31 11:26:23 -03:00
2012-05-17 18:45:20 -04:00
2013-04-29 15:41:56 -04:00
2013-07-01 14:06:47 -07:00
2012-04-15 12:44:40 -04:00
2009-12-26 20:43:57 -08:00
2008-02-29 11:46:17 -08:00
2012-05-15 20:14:35 -04:00
2008-03-31 21:02:47 -07:00
2012-09-17 13:13:24 -04:00
2013-06-13 11:58:47 +02:00
2012-06-26 21:06:11 -07:00
2010-06-03 03:21:52 -07:00
2010-04-23 13:35:55 +09:00
2013-02-10 20:37:22 -05:00
2013-06-19 23:18:07 -07:00
2013-02-11 00:21:44 -05:00
2013-06-26 18:01:46 +09:00
2011-05-27 13:41:33 -04:00
2009-01-06 11:38:15 -07:00
2013-01-14 15:04:59 -05:00
2012-09-17 18:08:54 -07:00
2012-09-10 15:30:41 -04:00
2013-04-09 13:19:37 -04:00
2013-02-27 19:10:24 -08:00
2006-09-22 14:55:04 -07:00
2009-08-19 23:08:22 +04:00
2013-06-05 16:37:30 -07:00
2013-01-14 15:09:36 -05:00
2013-02-12 18:59:45 -05:00
2012-11-15 17:39:51 -05:00
2009-03-21 19:06:50 -07:00
2010-09-08 13:42:22 -07:00
2012-05-19 01:08:16 -04:00
2012-04-16 23:53:11 -04:00
2013-01-03 13:01:30 +01:00
2013-04-22 15:55:48 -04:00
2011-03-27 17:59:04 -07:00
2012-11-03 14:59:04 -04:00
2013-03-22 10:31:16 -04:00
2013-06-11 22:39:47 -07:00
2013-04-22 20:32:51 -04:00
2013-04-29 15:14:02 -04:00
2012-08-06 13:40:47 -07:00
2013-06-19 21:16:53 -07:00
2008-07-05 21:25:39 -07:00
2012-04-10 10:04:07 -07:00
2013-06-25 02:44:05 -07:00
2012-06-09 14:56:12 -07:00
2013-06-04 16:43:42 -07:00
2013-06-12 00:47:25 -07:00
2012-03-12 17:05:21 -07:00
2009-10-07 16:39:43 -04:00
2012-04-15 12:44:40 -04:00
2012-05-16 15:17:08 -04:00
2012-04-15 12:44:40 -04:00
2010-04-22 16:12:36 -07:00
2013-05-31 17:30:07 -07:00