artulab
projects
/
openbsd
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d340763
)
Add mtx_enter/mtx_leave in kvp_pool_keys().
author
asou
<asou@openbsd.org>
Mon, 26 Jul 2021 06:00:37 +0000
(06:00 +0000)
committer
asou
<asou@openbsd.org>
Mon, 26 Jul 2021 06:00:37 +0000
(06:00 +0000)
ok mikeb
sys/dev/pv/hypervic.c
patch
|
blob
|
history
diff --git
a/sys/dev/pv/hypervic.c
b/sys/dev/pv/hypervic.c
index
ef96dce
..
ad5fc9b
100644
(file)
--- 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);
}