multiqueue: Fix potential deadlock with parallel release_pad calls
authorMart Raudsepp <mart.raudsepp@globalm.media>
Wed, 14 Dec 2022 21:30:54 +0000 (23:30 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 23 Dec 2022 13:08:54 +0000 (13:08 +0000)
commit3fa4ff056215d527e8b80e03a8285512da860b27
treed52187e775d992970e5cb7a27808b697883a8f3d
parent72884f141cc7f229cd7e7b4e6f2c59ce7d6f0cdd
multiqueue: Fix potential deadlock with parallel release_pad calls

Commit d3a66f9851ea introduced a potential deadlock with two parallel release_pad
calls, where one could release the main multiqueue lock (qlock) while still
holding the reconf_lock and then calling other routines which in some conditions
may try to acquire qlock again. The second release_pad could already acquire the
qlock and then start waiting on reconf_lock, which may never be possible because
because the first one isn't releasing it until it can acquire qlock.

Fix it by holding reconf_lock for the whole durationg of qlock, making this
particular deadlock impossible.

Fixes #1642

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3571>
subprojects/gstreamer/plugins/elements/gstmultiqueue.c