mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
Merge branch 'tcp-tcp-ao-connect-fixes'
Dmitry Safonov says: ==================== tcp: TCP-AO connect() fixes I've addeded credits to Qihang on patch 2; and a third patch/fix for static key decrement. ==================== Link: https://patch.msgid.link/20260625-tcp-md5-connect-v3-0-1fd313d6c1e0@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
622df5e337
|
|
@ -145,6 +145,7 @@ struct tcp_ao_info {
|
|||
u32 snd_sne;
|
||||
u32 rcv_sne;
|
||||
refcount_t refcnt; /* Protects twsk destruction */
|
||||
struct rcu_head rcu;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_TCP_MD5SIG
|
||||
|
|
|
|||
|
|
@ -371,8 +371,9 @@ static void tcp_ao_key_free_rcu(struct rcu_head *head)
|
|||
kfree_sensitive(key);
|
||||
}
|
||||
|
||||
static void tcp_ao_info_free(struct tcp_ao_info *ao)
|
||||
static void tcp_ao_info_free_rcu(struct rcu_head *head)
|
||||
{
|
||||
struct tcp_ao_info *ao = container_of(head, struct tcp_ao_info, rcu);
|
||||
struct tcp_ao_key *key;
|
||||
struct hlist_node *n;
|
||||
|
||||
|
|
@ -411,7 +412,7 @@ void tcp_ao_destroy_sock(struct sock *sk, bool twsk)
|
|||
|
||||
if (!twsk)
|
||||
tcp_ao_sk_omem_free(sk, ao);
|
||||
tcp_ao_info_free(ao);
|
||||
call_rcu(&ao->rcu, tcp_ao_info_free_rcu);
|
||||
}
|
||||
|
||||
void tcp_ao_time_wait(struct tcp_timewait_sock *tcptw, struct tcp_sock *tp)
|
||||
|
|
|
|||
|
|
@ -1467,9 +1467,9 @@ void tcp_clear_md5_list(struct sock *sk)
|
|||
md5sig = rcu_dereference_protected(tp->md5sig_info, 1);
|
||||
|
||||
hlist_for_each_entry_safe(key, n, &md5sig->head, node) {
|
||||
hlist_del(&key->node);
|
||||
hlist_del_rcu(&key->node);
|
||||
atomic_sub(sizeof(*key), &sk->sk_omem_alloc);
|
||||
kfree(key);
|
||||
kfree_rcu(key, rcu);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4329,9 +4329,13 @@ int tcp_connect(struct sock *sk)
|
|||
if (needs_md5) {
|
||||
tcp_ao_destroy_sock(sk, false);
|
||||
} else if (needs_ao) {
|
||||
struct tcp_md5sig_info *md5sig;
|
||||
|
||||
tcp_clear_md5_list(sk);
|
||||
kfree(rcu_replace_pointer(tp->md5sig_info, NULL,
|
||||
lockdep_sock_is_held(sk)));
|
||||
md5sig = rcu_replace_pointer(tp->md5sig_info, NULL,
|
||||
lockdep_sock_is_held(sk));
|
||||
kfree_rcu(md5sig, rcu);
|
||||
static_branch_slow_dec_deferred(&tcp_md5_needed);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user