diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2016-10-19 23:35:12 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-16 19:45:05 +0200 |
commit | faf458605614d2be3186c82e788640fa6aa3ce93 (patch) | |
tree | 3eda890aaf42af1d35b0fd3ed9c2a28de6cfec43 /include | |
parent | dcb33fe3d9a68303bd506e069b579725452fa5c7 (diff) | |
download | linux-stable-faf458605614d2be3186c82e788640fa6aa3ce93.tar.gz linux-stable-faf458605614d2be3186c82e788640fa6aa3ce93.tar.bz2 linux-stable-faf458605614d2be3186c82e788640fa6aa3ce93.zip |
ipv6: fix a potential deadlock in do_ipv6_setsockopt()
commit 8651be8f14a12d24f203f283601d9b0418c389ff upstream.
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>
Cc: Zubin Mithra <zsm@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/addrconf.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 18dd7a3caf2f..af032e5405f6 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -162,6 +162,7 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr); int ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *addr); +void __ipv6_sock_mc_close(struct sock *sk); void ipv6_sock_mc_close(struct sock *sk); bool inet6_mc_check(struct sock *sk, const struct in6_addr *mc_addr, const struct in6_addr *src_addr); |