summaryrefslogtreecommitdiff
path: root/sys/dev/pv
diff options
context:
space:
mode:
authorasou <asou@cvs.openbsd.org>2021-07-26 06:00:38 +0000
committerasou <asou@cvs.openbsd.org>2021-07-26 06:00:38 +0000
commitc76192eba764eca120c08d3a49e9b0db51c1a29b (patch)
tree5e061f7d8acf18c2047051e5dac23aa5633d5aeb /sys/dev/pv
parent36ab253002712caf7fb0e92375c8d399b29ed6a0 (diff)
Add mtx_enter/mtx_leave in kvp_pool_keys().
ok mikeb
Diffstat (limited to 'sys/dev/pv')
-rw-r--r--sys/dev/pv/hypervic.c7
1 files changed, 7 insertions, 0 deletions
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);
}