Re: [PATCH net] net/tcp: Disable TCP-AO static key after RCU grace period

From: Jakub Kicinski
Date: Fri Jul 26 2024 - 22:34:13 EST


On Thu, 25 Jul 2024 06:00:02 +0100 Dmitry Safonov via B4 Relay wrote:
> @@ -290,9 +298,7 @@ void tcp_ao_destroy_sock(struct sock *sk, bool twsk)
> atomic_sub(tcp_ao_sizeof_key(key), &sk->sk_omem_alloc);
> call_rcu(&key->rcu, tcp_ao_key_free_rcu);
> }
> -
> - kfree_rcu(ao, rcu);
> - static_branch_slow_dec_deferred(&tcp_ao_needed);
> + call_rcu(&ao->rcu, tcp_ao_info_free_rcu);

Maybe free the keys inside tcp_ao_info_free_rcu, too?
IIUC you're saying that new sock is still looking at this ao under RCU
protection - messing with the key list feels a tiny bit odd since the
object is technically "live" until the end of the RCU grace period.