]> granicus.if.org Git - esp-idf/commitdiff
mdns: fix possible deadlock on mdns deinit calling mdns_free()
authorDavid Cermak <cermak@espressif.com>
Mon, 4 Mar 2019 10:13:52 +0000 (11:13 +0100)
committerDavid Cermak <cermak@espressif.com>
Wed, 13 Mar 2019 15:24:03 +0000 (16:24 +0100)
mnds_free() initiates stop and delete timer tasks, which after locking the mutex could lead to a dead lock in case timer task executed before deleting the task, as it would wait indefinitelly for unlocking the mutex. This condition is fixed by calling _mdns_stop_timer without locking the mutex, because there's no need to protect any data when stopping and deleting the timer task

Closes https://github.com/espressif/esp-idf/issues/1696

components/mdns/mdns.c

index de82be515d986baa950720578d6024f5f3b87ca8..41896131466256d24484bb6dda5a2d4efa051c34 100644 (file)
@@ -4040,9 +4040,7 @@ static esp_err_t _mdns_service_task_start()
  */
 static esp_err_t _mdns_service_task_stop()
 {
-    MDNS_SERVICE_LOCK();
     _mdns_stop_timer();
-    MDNS_SERVICE_UNLOCK();
     if (_mdns_service_task_handle) {
         mdns_action_t action;
         mdns_action_t * a = &action;