From: Jiri Slaby jirislaby@kernel.org Date: Thu, 3 Apr 2025 12:46:43 +0200
On 03. 04. 25, 4:07, Kuniyuki Iwashima wrote: ...
--- a/net/core/sock.c +++ b/net/core/sock.c @@ -2324,6 +2324,12 @@ static void __sk_destruct(struct rcu_head *head) __netns_tracker_free(net, &sk->ns_tracker, false); net_passive_dec(net); }
+#if IS_ENABLED(CONFIG_PROVE_LOCKING) && IS_ENABLED(CONFIG_MODULES)
I don't know if this is the right approach at all (it appears not to me), but:
Having this check in random files looks error prone. Perhaps you want to introduce some macro like SOCK_NEEDS_OWNER? Or you introduce sk_put_owner().
include/net/sock.h and net/core/sock.c are not random files.
Also, __sk_destruct() is the other single user where all sockets are destroyed, so we have no reason to make sk_put_owner() available for modules.
But, I'll define sk_put_owner() with sk_set_owner() under the same config guard because I noticed I need to clear sk_owner in sk_clone_lock() for MPTCP, which needs sk_clear_owner() or another ifdef.
- if (sk->sk_owner)
The if is not needed.
Exactly, will remove it.
Thanks!
--- pw-bot: cr