diff options
author | Eric Dumazet <edumazet@google.com> | 2023-09-21 20:28:13 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-10-01 19:09:54 +0100 |
commit | b120251590a9c771bae353e444503fa49793c75e (patch) | |
tree | 915742bd1cab4fffb123bebf7b212a46c53acd72 /net/core/sock.c | |
parent | 8ebfb6db5a01f16cd37254bfad7145204e4bf6f2 (diff) |
net: lockless SO_{TYPE|PROTOCOL|DOMAIN|ERROR } setsockopt()
This options can not be set and return -ENOPROTOOPT,
no need to acqure socket lock.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/sock.c')
-rw-r--r-- | net/core/sock.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index f01c75724568..4d20b74a93cb 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1135,6 +1135,11 @@ int sk_setsockopt(struct sock *sk, int level, int optname, case SO_PASSPIDFD: assign_bit(SOCK_PASSPIDFD, &sock->flags, valbool); return 0; + case SO_TYPE: + case SO_PROTOCOL: + case SO_DOMAIN: + case SO_ERROR: + return -ENOPROTOOPT; } sockopt_lock_sock(sk); @@ -1152,12 +1157,6 @@ int sk_setsockopt(struct sock *sk, int level, int optname, case SO_REUSEPORT: sk->sk_reuseport = valbool; break; - case SO_TYPE: - case SO_PROTOCOL: - case SO_DOMAIN: - case SO_ERROR: - ret = -ENOPROTOOPT; - break; case SO_DONTROUTE: sock_valbool_flag(sk, SOCK_LOCALROUTE, valbool); sk_dst_reset(sk); |