Skip to content

Commit

Permalink
esp32c6: apply wifi deadlock fix from esp32s3
Browse files Browse the repository at this point in the history
cf. #15445
  • Loading branch information
yamt authored and xiaoxiang781216 committed Jan 14, 2025
1 parent 93dbdd4 commit 7a54488
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arch/risc-v/src/esp32c6/esp_wifi_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,13 @@ static void esp_evt_work_cb(void *arg)
break;
}

/* Some of the following logic (eg. esp_wlan_sta_set_linkstatus)
* can take net_lock(). To maintain the consistent locking order,
* we take net_lock() here before taking esp_wifi_lock. Note that
* net_lock() is a recursive lock.
*/

net_lock();
esp_wifi_lock(true);

switch (evt_adpt->id)
Expand Down Expand Up @@ -2651,6 +2658,7 @@ static void esp_evt_work_cb(void *arg)
}

esp_wifi_lock(false);
net_unlock();

kmm_free(evt_adpt);
}
Expand Down

0 comments on commit 7a54488

Please sign in to comment.