media: dvb: mpq: Fix race-condition in mutex locking

mpq_dmx_decoder_fullness_wait was called either from
dvb-demux or internally by the plug-in. In the first case
mutex should be locked before checking the video buffer while
in the second case it was called while the mutex was already
locked. Due to this the function checked whether the mutex is
already locked or not.

This check it not atomic, if the function is called by dvb-demux
while the mutex is un-locked, after this check it is possible
to have a context-switch and the mutex gets locked by other API
functions of the plug-in, which could lead to dead-lock or
invalid states.

Change-Id: I32ce4aa3ee7a93c1a8a4fda1d0f916e65eab11ce
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
1 file changed