diff options
author | Eric Dumazet <edumazet@google.com> | 2023-09-11 19:05:29 +0200 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2023-09-12 19:10:01 +0200 |
commit | 11445469dec803730ac7f78a5ad2a5ed131fa941 (patch) | |
tree | 26f85b36050f472902e38b507156f4a61dbfd69a /include/net/sock.h | |
parent | tcp: no longer release socket ownership in tcp_release_cb() (diff) | |
download | linux-11445469dec803730ac7f78a5ad2a5ed131fa941.tar.xz linux-11445469dec803730ac7f78a5ad2a5ed131fa941.zip |
net: sock_release_ownership() cleanup
sock_release_ownership() should only be called by user
owning the socket lock.
After prior commit, we can remove one condition.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index b770261fbdaf..676146e9d181 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1823,12 +1823,11 @@ static inline bool sock_owned_by_user_nocheck(const struct sock *sk) static inline void sock_release_ownership(struct sock *sk) { - if (sock_owned_by_user_nocheck(sk)) { - sk->sk_lock.owned = 0; + DEBUG_NET_WARN_ON_ONCE(!sock_owned_by_user_nocheck(sk)); + sk->sk_lock.owned = 0; - /* The sk_lock has mutex_unlock() semantics: */ - mutex_release(&sk->sk_lock.dep_map, _RET_IP_); - } + /* The sk_lock has mutex_unlock() semantics: */ + mutex_release(&sk->sk_lock.dep_map, _RET_IP_); } /* no reclassification while locks are held */ |