From: Mark Andrews Date: Wed, 6 Apr 2022 02:56:17 +0000 (+1000) Subject: Move lock to before label to prevent duplicate lock X-Git-Tag: v9.19.0~13^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ed1e480c53c354e0369cb52fb8b9a32e9cbe2779;p=thirdparty%2Fbind9.git Move lock to before label to prevent duplicate lock *** CID 351370: Program hangs (LOCK) /lib/dns/adb.c: 2699 in dns_adb_cancelfind() 2693 2694 LOCK(&nbucket->lock); 2695 ISC_LIST_UNLINK(adbname->finds, find, plink); 2696 UNLOCK(&nbucket->lock); 2697 2698 cleanup: >>> CID 351370: Program hangs (LOCK) >>> "pthread_mutex_lock" locks "find->lock" while it is locked. 2699 LOCK(&find->lock); 2700 if (!FIND_EVENTSENT(find)) { 2701 ev = &find->event; 2702 task = ev->ev_sender; 2703 ev->ev_sender = find; 2704 ev->ev_type = DNS_EVENT_ADBCANCELED; --- diff --git a/lib/dns/adb.c b/lib/dns/adb.c index e572dee2391..ae616710a41 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -2687,14 +2687,14 @@ dns_adb_cancelfind(dns_adbfind_t *find) { adbname = find->adbname; find->adbname = NULL; nbucket = adbname->bucket; - UNLOCK(&find->lock); + UNLOCK(&find->lock); LOCK(&nbucket->lock); ISC_LIST_UNLINK(adbname->finds, find, plink); UNLOCK(&nbucket->lock); + LOCK(&find->lock); cleanup: - LOCK(&find->lock); if (!FIND_EVENTSENT(find)) { ev = &find->event; task = ev->ev_sender;