diff options
author | Brent Cook <bcook@cvs.openbsd.org> | 2019-05-13 22:36:02 +0000 |
---|---|---|
committer | Brent Cook <bcook@cvs.openbsd.org> | 2019-05-13 22:36:02 +0000 |
commit | 290e16ea0da158fac19cd64998efb6b32a225b1f (patch) | |
tree | b6eb26f0f6a7986cc96ffdc7180a54f0a920a036 | |
parent | 23012732eed719909b23b6545ff642dd547a7824 (diff) |
Acquire mutex before incrementing the refcount. Fixes COV-186144
ok tb@
-rw-r--r-- | lib/libtls/tls_server.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libtls/tls_server.c b/lib/libtls/tls_server.c index 44bef6bb11d..a709a2bec92 100644 --- a/lib/libtls/tls_server.c +++ b/lib/libtls/tls_server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls_server.c,v 1.44 2018/03/19 16:34:47 jsing Exp $ */ +/* $OpenBSD: tls_server.c,v 1.45 2019/05/13 22:36:01 bcook Exp $ */ /* * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> * @@ -52,7 +52,9 @@ tls_server_conn(struct tls *ctx) conn_ctx->flags |= TLS_SERVER_CONN; + pthread_mutex_lock(&ctx->config->mutex); ctx->config->refcount++; + pthread_mutex_unlock(&ctx->config->mutex); conn_ctx->config = ctx->config; conn_ctx->keypair = ctx->config->keypair; |