diff --git a/esp-wifi/CHANGELOG.md b/esp-wifi/CHANGELOG.md index 7af1bf14057..d757f42955d 100644 --- a/esp-wifi/CHANGELOG.md +++ b/esp-wifi/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed a problem using BLE on ESP32-C6 when connected via Serial-JTAG (#2981) +- Fix a possible dead-lock when the rx-queue is overrun (#3015) + ### Removed ## 0.12.0 - 2025-01-15 diff --git a/esp-wifi/src/wifi/mod.rs b/esp-wifi/src/wifi/mod.rs index aede5895434..8f4e93e6f19 100644 --- a/esp-wifi/src/wifi/mod.rs +++ b/esp-wifi/src/wifi/mod.rs @@ -1536,12 +1536,12 @@ unsafe extern "C" fn recv_cb_sta( // which will try to lock an internal mutex. If the mutex is already taken, // the function will try to trigger a context switch, which will fail if we // are in an interrupt-free context. - if DATA_QUEUE_RX_STA.with(|queue| { + if let Ok(()) = DATA_QUEUE_RX_STA.with(|queue| { if queue.len() < RX_QUEUE_SIZE { queue.push_back(packet); - true + Ok(()) } else { - false + Err(packet) } }) { embassy::STA_RECEIVE_WAKER.wake(); @@ -1564,12 +1564,12 @@ unsafe extern "C" fn recv_cb_ap( // which will try to lock an internal mutex. If the mutex is already taken, // the function will try to trigger a context switch, which will fail if we // are in an interrupt-free context. - if DATA_QUEUE_RX_AP.with(|queue| { + if let Ok(()) = DATA_QUEUE_RX_AP.with(|queue| { if queue.len() < RX_QUEUE_SIZE { queue.push_back(packet); - true + Ok(()) } else { - false + Err(packet) } }) { embassy::AP_RECEIVE_WAKER.wake();