From: asou Date: Mon, 26 Jul 2021 06:00:37 +0000 (+0000) Subject: Add mtx_enter/mtx_leave in kvp_pool_keys(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1ab70bb7067937e34ac0e67bb350baa86e8821f7;p=openbsd Add mtx_enter/mtx_leave in kvp_pool_keys(). ok mikeb --- diff --git a/sys/dev/pv/hypervic.c b/sys/dev/pv/hypervic.c index ef96dce7f44..ad5fc9b0c0b 100644 --- a/sys/dev/pv/hypervic.c +++ b/sys/dev/pv/hypervic.c @@ -759,14 +759,21 @@ kvp_pool_keys(struct kvp_pool *kvpl, int next, char *key, size_t *keylen) struct kvp_entry *kpe; int iter = 0; + mtx_enter(&kvpl->kvp_lock); + TAILQ_FOREACH(kpe, &kvpl->kvp_entries, kpe_entry) { if (iter++ < next) continue; *keylen = strlen(kpe->kpe_key) + 1; strlcpy(key, kpe->kpe_key, *keylen); + + mtx_leave(&kvpl->kvp_lock); + return (0); } + mtx_leave(&kvpl->kvp_lock); + return (-1); }