Skip to content

Commit 424b75b

Browse files
hverkuilgregkh
authored andcommitted
media: vim2m: only cancel work if it is for right context
[ Upstream commit 240809e ] cancel_delayed_work_sync() was called for any queue, but it should only be called for the queue that is associated with the currently running job. Otherwise, if two filehandles are streaming at the same time, then closing the first will cancel the work which might still be running for a job from the second filehandle. As a result the second filehandle will never be able to finish the job and an attempt to stop streaming on that second filehandle will stall. Fixes: 52117be ("media: vim2m: use cancel_delayed_work_sync instead of flush_schedule_work") Signed-off-by: Hans Verkuil <[email protected]> Cc: <[email protected]> # for v4.20 and up Signed-off-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent be77686 commit 424b75b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/media/platform/vim2m.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,9 @@ static void vim2m_stop_streaming(struct vb2_queue *q)
801801
struct vb2_v4l2_buffer *vbuf;
802802
unsigned long flags;
803803

804-
cancel_delayed_work_sync(&dev->work_run);
804+
if (v4l2_m2m_get_curr_priv(dev->m2m_dev) == ctx)
805+
cancel_delayed_work_sync(&dev->work_run);
806+
805807
for (;;) {
806808
if (V4L2_TYPE_IS_OUTPUT(q->type))
807809
vbuf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx);

0 commit comments

Comments
 (0)