[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190709193610.1f090ed4@cakuba.netronome.com>
Date: Tue, 9 Jul 2019 19:36:10 -0700
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: John Fastabend <john.fastabend@...il.com>
Cc: ast@...nel.org, daniel@...earbox.net, netdev@...r.kernel.org,
edumazet@...gle.com, bpf@...r.kernel.org
Subject: Re: [bpf PATCH v2 6/6] bpf: sockmap/tls, close can race with map
free
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;
> }
Powered by blists - more mailing lists