Skip to content

Commit ee181e5

Browse files
Ilya Lesokhindavem330
Ilya Lesokhin
authored andcommitted
tls: don't override sk_write_space if tls_set_sw_offload fails.
If we fail to enable tls in the kernel we shouldn't override the sk_write_space callback Fixes: 3c4d755 ('tls: kernel TLS support') Signed-off-by: Ilya Lesokhin <ilyal@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 196c31b commit ee181e5

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

net/tls/tls_main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,6 @@ static int do_tls_setsockopt_tx(struct sock *sk, char __user *optval,
401401
goto out;
402402
}
403403

404-
ctx->sk_write_space = sk->sk_write_space;
405-
sk->sk_write_space = tls_write_space;
406-
407404
/* currently SW is default, we will have ethtool in future */
408405
rc = tls_set_sw_offload(sk, ctx);
409406
tx_conf = TLS_SW_TX;
@@ -412,6 +409,8 @@ static int do_tls_setsockopt_tx(struct sock *sk, char __user *optval,
412409

413410
ctx->tx_conf = tx_conf;
414411
update_sk_prot(sk, ctx);
412+
ctx->sk_write_space = sk->sk_write_space;
413+
sk->sk_write_space = tls_write_space;
415414
goto out;
416415

417416
err_crypto_info:

0 commit comments

Comments
 (0)