On Mon, 08 Jul 2019 19:15:18 +0000, John Fastabend wrote:
> @@ -836,22 +841,39 @@ static int tls_init(struct sock *sk)
There is a goto out above this which has to be turned into return 0;
if out now releases the lock.
> if (sk->sk_state != TCP_ESTABLISHED)
> return -ENOTSUPP;
>
> + tls_build_proto(sk);
> +
> /* allocate tls context */
> + write_lock_bh(&sk->sk_callback_lock);
> ctx = create_ctx(sk);
> if (!ctx) {
> rc = -ENOMEM;
> goto out;
> }
>
> - tls_build_proto(sk);
> ctx->tx_conf = TLS_BASE;
> ctx->rx_conf = TLS_BASE;
> ctx->sk_proto = sk->sk_prot;
> update_sk_prot(sk, ctx);
> out:
> + write_unlock_bh(&sk->sk_callback_lock);
> return rc;
> }