Skip to content

Commit 06cc878

Browse files
qsnkuba-moo
authored andcommitted
tls: skip setting sk_write_space on rekey
syzbot reported a problem when calling setsockopt(SO_SNDBUF) after a rekey. SO_SNDBUF calls sk_write_space, ie tls_write_space, which then calls the original socket's sk_write_space, saved in ctx->sk_write_space. Rekeys should skip re-assigning ctx->sk_write_space, so we don't end up with tls_write_space calling itself. Fixes: 4706959 ("tls: implement rekey for TLS1.3") Reported-by: [email protected] Closes: https://lore.kernel.org/netdev/[email protected]/ Tested-by: [email protected] Signed-off-by: Sabrina Dubroca <[email protected]> Link: https://patch.msgid.link/ffdbe4de691d1c1eead556bbf42e33ae215304a7.1736436785.git.sd@queasysnail.net Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b493f88 commit 06cc878

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/tls/tls_main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,10 @@ static int do_tls_setsockopt_conf(struct sock *sk, sockptr_t optval,
737737
else
738738
ctx->rx_conf = conf;
739739
update_sk_prot(sk, ctx);
740+
741+
if (update)
742+
return 0;
743+
740744
if (tx) {
741745
ctx->sk_write_space = sk->sk_write_space;
742746
sk->sk_write_space = tls_write_space;

0 commit comments

Comments
 (0)