Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <ktkhai@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Kirill Tkhai and committed by
David S. Miller
0526947f 76d3e153

+2 -3
+2 -3
net/ipv4/ip_sockglue.c
··· 647 647 648 648 /* If optlen==0, it is equivalent to val == 0 */ 649 649 650 + if (optname == IP_ROUTER_ALERT) 651 + return ip_ra_control(sk, val ? 1 : 0, NULL); 650 652 if (ip_mroute_opt(optname)) 651 653 return ip_mroute_setsockopt(sk, optname, optval, optlen); 652 654 ··· 1158 1156 if (val != 0 && val != 1) 1159 1157 goto e_inval; 1160 1158 inet->mc_all = val; 1161 - break; 1162 - case IP_ROUTER_ALERT: 1163 - err = ip_ra_control(sk, val ? 1 : 0, NULL); 1164 1159 break; 1165 1160 1166 1161 case IP_FREEBIND: