Commit 3523bc91 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

inet: lockless getsockopt(IP_MTU)

sk_dst_get() does not require socket lock.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a4725d0d
...@@ -1620,13 +1620,6 @@ int do_ip_getsockopt(struct sock *sk, int level, int optname, ...@@ -1620,13 +1620,6 @@ int do_ip_getsockopt(struct sock *sk, int level, int optname,
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
}
if (needs_rtnl)
rtnl_lock();
sockopt_lock_sock(sk);
switch (optname) {
case IP_MTU: case IP_MTU:
{ {
struct dst_entry *dst; struct dst_entry *dst;
...@@ -1636,12 +1629,17 @@ int do_ip_getsockopt(struct sock *sk, int level, int optname, ...@@ -1636,12 +1629,17 @@ int do_ip_getsockopt(struct sock *sk, int level, int optname,
val = dst_mtu(dst); val = dst_mtu(dst);
dst_release(dst); dst_release(dst);
} }
if (!val) { if (!val)
sockopt_release_sock(sk);
return -ENOTCONN; return -ENOTCONN;
goto copyval;
} }
break;
} }
if (needs_rtnl)
rtnl_lock();
sockopt_lock_sock(sk);
switch (optname) {
case IP_UNICAST_IF: case IP_UNICAST_IF:
val = (__force int)htonl((__u32) inet->uc_index); val = (__force int)htonl((__u32) inet->uc_index);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment