Le lundi 09 novembre 2026 à 14:28 +0900, Jackson.lee a écrit : > From: Brandon Brnich > > feed_lock was introduced in decoder performance improvements. This was > used to ensure atomic access to the driver's avail_src_buf list during > fill_ringbuffer, streamoff_output, and buf_queue. While this protected > the drivers available src bufs, the v4l2_m2m_src_bufs were not being > protected at driver level. Three separate threads have access to remove > buffers: start_decode fail path, streamoff_output, and finish_decode. > > In streamoff_output(), replace the inst_src_buf_remove() loop with > list_for_each_entry_safe(). inst_src_buf_remove() takes feed_lock > itself, so calling it while streamoff_output() holds feed_lock would > take the same mutex twice and deadlock. Unlink each entry with > list_del_init() directly instead. > > In wave5_handle_src_buffer(), feed_lock does not serialize against > v4l2_m2m_buf_queue(), which buf_queue calls after dropping feed_lock and > which adds to the ready queue under rdy_spinlock only. Walking the ready > queue with v4l2_m2m_for_each_src_buf_safe() therefore races with > VIDIOC_QBUF. The loop only ever looks at the head of the queue, so peek > it with v4l2_m2m_next_src_buf(), which takes rdy_spinlock, instead. > > Fixes: a176ac5e701f ("media: chips-media: wave5: Improve performance of decoder") > Cc: stable@vger.kernel.org > Signed-off-by: Brandon Brnich > Signed-off-by: Jackson Lee > Signed-off-by: Nas Chung Reviewed-by: Nicolas Dufresne