Files
PX4-Autopilot/platforms/qurt
rikaken2004 3896747134 fix(qurt): hold recursive mutex across hrt callout invocation
_hrt_lock was a px4_sem_t and hrt_call_invoke() dropped it around the
callback so callbacks could re-enter hrt_call_*. That exposed the
callout queue to other threads mid-invocation: the entry is removed
with deadline reset to 0 (the "unqueued" sentinel), then re-inserted
unconditionally by the periodic re-arm path. Another thread re-arming
the same entry in that window (e.g. via
ScheduledWorkItem::ScheduleOnInterval()) re-inserts it too, and the
second hrt_call_enter() links the node twice, tearing the queue.

Switch _hrt_lock to a PTHREAD_MUTEX_RECURSIVE pthread_mutex and hold
it across the callout, mirroring the posix fix 9b62a1701d and matching
NuttX's enter_critical_section() nesting semantics. QURT already
relies on recursive pthread mutexes in code that runs on the DSP
today (atomic_transaction.cpp, mavlink_main.cpp).

Fixes #28922
2026-10-01 09:30:25 -07:00
..