Skip to content

Commit 22ebec7

Browse files
0x7f454c46gregkh
authored andcommitted
tcp: Decrement tcp_md5_needed static branch
[ Upstream commit 6f6e860 ] In case of early freeing an unwanted TCP-MD5 key on TCP-AO connect(), md5sig_info is freed right away (and set to NULL). Later, at the moment of socket destruction, the static branch counter is not getting decremented. Add a missing decrement for TCP-MD5 static branch. Reported-by: Qihang <q.h.hack.winter@gmail.com> Fixes: 0aadc73 ("net/tcp: Prevent TCP-MD5 with TCP-AO being set") Cc: stable@vger.kernel.org Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com> Link: https://patch.msgid.link/20260625-tcp-md5-connect-v3-3-1fd313d6c1e0@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 08d7668 commit 22ebec7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

net/ipv4/tcp_output.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4124,8 +4124,8 @@ int tcp_connect(struct sock *sk)
41244124
tcp_clear_md5_list(sk);
41254125
md5sig = rcu_replace_pointer(tp->md5sig_info, NULL,
41264126
lockdep_sock_is_held(sk));
4127-
if (md5sig)
4128-
kfree_rcu(md5sig, rcu);
4127+
kfree_rcu(md5sig, rcu);
4128+
static_branch_slow_dec_deferred(&tcp_md5_needed);
41294129
}
41304130
}
41314131
#endif

0 commit comments

Comments
 (0)