From: xiangbao227 <1004129700@qq.com> Date: Wed, 13 Jan 2021 02:33:41 +0000 (+0800) Subject: I found that in function lruhash_remove, table was locked at first ,then lru_remove... X-Git-Tag: release-1.13.1rc1~23^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F399%2Fhead;p=thirdparty%2Funbound.git I found that in function lruhash_remove, table was locked at first ,then lru_remove the entry , then unlock the table, and then markdel entry , but in function rrset_cache_touch , the entry will be touched to lru again before markdelling entry in function lruhash_remove. This is a bug! --- diff --git a/util/storage/lruhash.c b/util/storage/lruhash.c index 0003ff491..3500a4ef0 100644 --- a/util/storage/lruhash.c +++ b/util/storage/lruhash.c @@ -398,13 +398,13 @@ lruhash_remove(struct lruhash* table, hashvalue_type hash, void* key) return; } table->num--; - table->space_used -= (*table->sizefunc)(entry->key, entry->data); - lock_quick_unlock(&table->lock); + table->space_used -= (*table->sizefunc)(entry->key, entry->data); lock_rw_wrlock(&entry->lock); if(table->markdelfunc) (*table->markdelfunc)(entry->key); lock_rw_unlock(&entry->lock); lock_quick_unlock(&bin->lock); + lock_quick_unlock(&table->lock); /* finish removal */ d = entry->data; (*table->delkeyfunc)(entry->key, table->cb_arg);