diff options
author | WANG Cong <[email protected]> | 2015-11-03 15:41:16 -0800 |
---|---|---|
committer | David S. Miller <[email protected]> | 2015-11-04 21:29:59 -0500 |
commit | 87e9f0315952b0dd8b5e51ba04beda03efc009d9 (patch) | |
tree | 0e7621915ad9824230e0a33d1027f6c7d8e35e36 /lib/string_helpers.c | |
parent | 4ee3bd4a8c7463cdef0b82ebc33fc94a9170a7e0 (diff) |
ipv4: fix a potential deadlock in mcast getsockopt() path
Sasha reported the following lockdep warning:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(sk_lock-AF_INET);
lock(rtnl_mutex);
lock(sk_lock-AF_INET);
lock(rtnl_mutex);
This is due to that for IP_MSFILTER and MCAST_MSFILTER, we take
rtnl lock before the socket lock in setsockopt() path, but take
the socket lock before rtnl lock in getsockopt() path. All the
rest optnames are setsockopt()-only.
Fix this by aligning the getsockopt() path with the setsockopt()
path, so that all mcast socket path would be locked in the same
order.
Note, IPv6 part is different where rtnl lock is not held.
Fixes: 54ff9ef36bdf ("ipv4, ipv6: kill ip_mc_{join, leave}_group and ipv6_sock_mc_{join, drop}")
Reported-by: Sasha Levin <[email protected]>
Cc: Marcelo Ricardo Leitner <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
Reviewed-by: Marcelo Ricardo Leitner <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'lib/string_helpers.c')
0 files changed, 0 insertions, 0 deletions