From: Kirill Tkhai Date: Thu, 22 Mar 2018 09:45:12 +0000 (+0300) Subject: net: Move IP_ROUTER_ALERT out of lock_sock(sk) X-Git-Tag: for-linus-20180413~64^2~136^2~3 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=0526947f9dd019da8d550ed20177585a84b3460e;p=linux-block.git net: Move IP_ROUTER_ALERT out of lock_sock(sk) ip_ra_control() does not need sk_lock. Who are the another users of ip_ra_chain? ip_mroute_setsockopt() doesn't take sk_lock, while parallel IP_ROUTER_ALERT syscalls are synchronized by ip_ra_lock. So, we may move this command out of sk_lock. Signed-off-by: Kirill Tkhai Signed-off-by: David S. Miller --- diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index be7c3b71914d..dcbf6afe27e7 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -647,6 +647,8 @@ static int do_ip_setsockopt(struct sock *sk, int level, /* If optlen==0, it is equivalent to val == 0 */ + if (optname == IP_ROUTER_ALERT) + return ip_ra_control(sk, val ? 1 : 0, NULL); if (ip_mroute_opt(optname)) return ip_mroute_setsockopt(sk, optname, optval, optlen); @@ -1157,9 +1159,6 @@ mc_msf_out: goto e_inval; inet->mc_all = val; break; - case IP_ROUTER_ALERT: - err = ip_ra_control(sk, val ? 1 : 0, NULL); - break; case IP_FREEBIND: if (optlen < 1)