Skip to content

Commit

Permalink
esp-wifi: fix possible deadlock (esp-rs#3015)
Browse files Browse the repository at this point in the history
* Fix possible deadlock

* CHANGELOG

* avoid `mem::forget`
  • Loading branch information
bjoernQ authored Jan 22, 2025
1 parent 4ea6b76 commit 16af010
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions esp-wifi/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions esp-wifi/src/wifi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit 16af010

Please sign in to comment.