]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Move lock to before label to prevent duplicate lock
authorMark Andrews <marka@isc.org>
Wed, 6 Apr 2022 02:56:17 +0000 (12:56 +1000)
committerMark Andrews <marka@isc.org>
Wed, 6 Apr 2022 02:56:17 +0000 (12:56 +1000)
    *** 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;

lib/dns/adb.c

index e572dee2391f4683182a937d20bfd06725f5f594..ae616710a41f37e8ee6e443bdd10f6784da2f755 100644 (file)
@@ -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;