]> git.ipfire.org Git - thirdparty/suricata.git/commit
packetpool: improve thread safety 13518/head
authorVictor Julien <vjulien@oisf.net>
Sat, 21 Jun 2025 14:10:47 +0000 (16:10 +0200)
committerVictor Julien <victor@inliniac.net>
Sat, 21 Jun 2025 19:32:54 +0000 (21:32 +0200)
commitf26f7505db5dfae3dddbe501dcf6485f0f48ca2a
tree7396392e4b66850c0b8b7e522a45881944f95bfd
parent65ff3dfa88504320179317e7a9834213a0279a6e
packetpool: improve thread safety

 lock_acquire: Calling pthread_mutex_lock acquires lock PktPoolLockedStack_.mutex.
 87        SCMutexLock(&my_pool->return_stack.mutex);

CID 1554228: (#1 of 1): Indefinite wait (BAD_CHECK_OF_WAIT_COND)
dead_wait: A wait is performed without ensuring that the condition is not already satisfied while holding lock PktPoolLockedStack_.mutex. This can cause a deadlock if the notification happens before the lock is acquired.
      Acquire the lock, then check the wait condition in a loop, without releasing with the lock before the wait. This will prevent deadlocks and failed conditions from spurious wakeups.
src/tmqh-packetpool.c