Merge branch '3354-cid-352776-missing_lock-v9_18' into 'v9_18'

[v9_18] Fix CID 352776: Concurrent data access violations

See merge request isc-projects/bind9!6344
This commit is contained in:
Matthijs Mekking 2022-05-23 10:39:43 +00:00
commit 1b15ff89b5
2 changed files with 19 additions and 3 deletions

View file

@ -461,22 +461,38 @@ dst_key_tofile(const dst_key_t *key, int type, const char *directory) {
void
dst_key_setexternal(dst_key_t *key, bool value) {
REQUIRE(VALID_KEY(key));
key->external = value;
}
bool
dst_key_isexternal(dst_key_t *key) {
REQUIRE(VALID_KEY(key));
return (key->external);
}
void
dst_key_setmodified(dst_key_t *key, bool value) {
REQUIRE(VALID_KEY(key));
isc_mutex_lock(&key->mdlock);
key->modified = value;
isc_mutex_unlock(&key->mdlock);
}
bool
dst_key_ismodified(dst_key_t *key) {
return (key->modified);
dst_key_ismodified(const dst_key_t *key) {
bool modified;
REQUIRE(VALID_KEY(key));
isc_mutex_lock(&(((dst_key_t *)key)->mdlock));
modified = key->modified;
isc_mutex_unlock(&(((dst_key_t *)key)->mdlock));
return (modified);
}
isc_result_t

View file

@ -1118,7 +1118,7 @@ dst_key_setmodified(dst_key_t *key, bool value);
*/
bool
dst_key_ismodified(dst_key_t *key);
dst_key_ismodified(const dst_key_t *key);
/*%<
* Check if the key file has been modified.
*