diff options
author | Kuniyuki Iwashima <kuniyu@amazon.co.jp> | 2021-12-08 09:21:58 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-12-11 06:43:00 +0300 |
commit | 33d60fbd21fa6f71a88571209e301ec6de59f81b (patch) | |
tree | 3e163274b8b1a636ab4b5aaf05fd0370ea806ff5 /net/core/sock.c | |
parent | be3158290db8376f49a92d30791dd8899f748aed (diff) | |
download | linux-33d60fbd21fa6f71a88571209e301ec6de59f81b.tar.xz |
sock: Use sock_owned_by_user_nocheck() instead of sk_lock.owned.
This patch moves sock_release_ownership() down in include/net/sock.h and
replaces some sk_lock.owned tests with sock_owned_by_user_nocheck().
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
Link: https://lore.kernel.org/r/20211208062158.54132-1-kuniyu@amazon.co.jp
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core/sock.c')
-rw-r--r-- | net/core/sock.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index 1a6a92539790..e21485ab285d 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -3292,7 +3292,7 @@ void lock_sock_nested(struct sock *sk, int subclass) might_sleep(); spin_lock_bh(&sk->sk_lock.slock); - if (sk->sk_lock.owned) + if (sock_owned_by_user_nocheck(sk)) __lock_sock(sk); sk->sk_lock.owned = 1; spin_unlock_bh(&sk->sk_lock.slock); @@ -3323,7 +3323,7 @@ bool __lock_sock_fast(struct sock *sk) __acquires(&sk->sk_lock.slock) might_sleep(); spin_lock_bh(&sk->sk_lock.slock); - if (!sk->sk_lock.owned) { + if (!sock_owned_by_user_nocheck(sk)) { /* * Fast path return with bottom halves disabled and * sock::sk_lock.slock held. |