Re: [PATCH] tls: fix missing memory barrier in tls_init

From: Jakub Kicinski
Date: Fri Nov 10 2023 - 14:47:39 EST


On Fri, 10 Nov 2023 19:57:23 +0900 Dae R. Jeong wrote:
> + mutex_init(&ctx->tx_lock);
> + ctx->sk_proto = READ_ONCE(sk->sk_prot);
> + ctx->sk = sk;
> ctx->tx_conf = TLS_BASE;
> ctx->rx_conf = TLS_BASE;

TLS_BASE is 0, so there's no strong reason to move the rcu assign
after *x_conf init. It's already 0. You can replace the assignment
with WARN_ON(ctx->tx_conf != TLS_BASE) to make sure, and move that
into tls_ctx_create() instead of removing that function.

FWIW make sure you read this before posting v2:

https://www.kernel.org/doc/html/next/process/maintainer-netdev.html