WANG Cong 8651be8f14 ipv6: fix a potential deadlock in do_ipv6_setsockopt()
Baozeng reported this deadlock case:

       CPU0                    CPU1
       ----                    ----
  lock([  165.136033] sk_lock-AF_INET6);
                               lock([  165.136033] rtnl_mutex);
                               lock([  165.136033] sk_lock-AF_INET6);
  lock([  165.136033] rtnl_mutex);

Similar to commit 87e9f0315952
("ipv4: fix a potential deadlock in mcast getsockopt() path")
this is due to we still have a case, ipv6_sock_mc_close(),
where we acquire sk_lock before rtnl_lock. Close this deadlock
with the similar solution, that is always acquire rtnl lock first.

Fixes: baf606d9c9b1 ("ipv4,ipv6: grab rtnl before locking the socket")
Reported-by: Baozeng Ding <sploving1@gmail.com>
Tested-by: Baozeng Ding <sploving1@gmail.com>
Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-21 11:29:02 -04:00
..
2016-09-01 14:09:01 -07:00
2015-08-25 13:37:31 -07:00
2016-09-10 23:12:51 -07:00
2016-10-20 14:32:22 -04:00
2016-10-14 10:01:26 -04:00
2016-05-31 14:07:49 -07:00
2016-09-10 23:12:52 -07:00
2016-04-27 22:48:24 -04:00
2016-06-27 15:06:17 -04:00
2015-11-03 10:52:13 -05:00
2016-08-23 23:23:50 -07:00
2016-09-21 10:09:14 +02:00
2016-09-21 10:09:14 +02:00