pad: race on EOS status
The scenario is the following:
- Thread 1 is pushing an EOS event on a sinkpad
- Thread 2 is pushing a STREAM_START event on the same sinkpad before Thread 1 returns. Note : It starts pushing the event after Thread 1 took the object lock.
There is a potential race between:
- The moment Thread 1 sets the EOS flag once it has finished sending the event (via
store_sticky_event
). When it does that it has both theSTREAM
andOBJECT
lock - The moment Thread 2 sends the STREAM_START event (Which should release that EOS status), but removing the EOS flag is only done while holding the
OBJECT
lock and not theSTREAM_LOCK
, which means it could be re-set by Thread 1 before it then checks again the EOS flag (without theSTREAM
lock taken).
The EOS flag unsetting by STREAM_START should be done with the STREAM
lock taken, otherwise it will be racy.