diff options
author | bcook <> | 2019-05-13 22:36:01 +0000 |
---|---|---|
committer | bcook <> | 2019-05-13 22:36:01 +0000 |
commit | 2e7ff92c365b42b38bc2d8d2b9718623d720203a (patch) | |
tree | abb5f306c4ba36e845d97e62d18a0bed8f31212f | |
parent | 70b2a950f692eeeb801c24634d9740964ff30a50 (diff) | |
download | openbsd-2e7ff92c365b42b38bc2d8d2b9718623d720203a.tar.gz openbsd-2e7ff92c365b42b38bc2d8d2b9718623d720203a.tar.bz2 openbsd-2e7ff92c365b42b38bc2d8d2b9718623d720203a.zip |
Acquire mutex before incrementing the refcount. Fixes COV-186144
ok tb@
-rw-r--r-- | src/lib/libtls/tls_server.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/libtls/tls_server.c b/src/lib/libtls/tls_server.c index 44bef6bb11..a709a2bec9 100644 --- a/src/lib/libtls/tls_server.c +++ b/src/lib/libtls/tls_server.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls_server.c,v 1.44 2018/03/19 16:34:47 jsing Exp $ */ | 1 | /* $OpenBSD: tls_server.c,v 1.45 2019/05/13 22:36:01 bcook Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -52,7 +52,9 @@ tls_server_conn(struct tls *ctx) | |||
52 | 52 | ||
53 | conn_ctx->flags |= TLS_SERVER_CONN; | 53 | conn_ctx->flags |= TLS_SERVER_CONN; |
54 | 54 | ||
55 | pthread_mutex_lock(&ctx->config->mutex); | ||
55 | ctx->config->refcount++; | 56 | ctx->config->refcount++; |
57 | pthread_mutex_unlock(&ctx->config->mutex); | ||
56 | 58 | ||
57 | conn_ctx->config = ctx->config; | 59 | conn_ctx->config = ctx->config; |
58 | conn_ctx->keypair = ctx->config->keypair; | 60 | conn_ctx->keypair = ctx->config->keypair; |