From 08a0d7f53abe254b1fc9579de8e3a67d1c5f8a89 Mon Sep 17 00:00:00 2001 From: Oleksandr Babak Date: Wed, 2 Apr 2025 17:57:48 +0200 Subject: feat: do not cause memory corruption if `remove_from_list` (safe function) is called multiple times --- rtic-common/src/wait_queue.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'rtic-common/src') diff --git a/rtic-common/src/wait_queue.rs b/rtic-common/src/wait_queue.rs index a3f5cab..4debcb9 100644 --- a/rtic-common/src/wait_queue.rs +++ b/rtic-common/src/wait_queue.rs @@ -140,6 +140,10 @@ impl Link { /// Remove this link from a linked list. pub fn remove_from_list(&self, list: &DoublyLinkedList) { + if self.is_popped() { + return; + } + cs::with(|_| { // Make sure all previous writes are visible core::sync::atomic::fence(Ordering::SeqCst); -- cgit v1.2.3