Skip to content

Commit eb1d969

Browse files
hverkuilmchehab
authored andcommitted
media: vivid: fix control handler mutex deadlock
vivid_update_format_cap() can be called from an s_ctrl callback. In that case (keep_controls == true) no control framework functions can be called that take the control handler mutex. The new call to v4l2_ctrl_modify_dimensions() did exactly that. Signed-off-by: Hans Verkuil <[email protected]> Fixes: 6bc7643 (media: vivid: add pixel_array test control) Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 8da7f09 commit eb1d969

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/media/test-drivers/vivid/vivid-vid-cap.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,14 @@ void vivid_update_format_cap(struct vivid_dev *dev, bool keep_controls)
466466
tpg_s_video_aspect(&dev->tpg, vivid_get_video_aspect(dev));
467467
tpg_s_pixel_aspect(&dev->tpg, vivid_get_pixel_aspect(dev));
468468
tpg_update_mv_step(&dev->tpg);
469+
470+
/*
471+
* We can be called from within s_ctrl, in that case we can't
472+
* modify controls. Luckily we don't need to in that case.
473+
*/
474+
if (keep_controls)
475+
return;
476+
469477
dims[0] = roundup(dev->src_rect.width, PIXEL_ARRAY_DIV);
470478
dims[1] = roundup(dev->src_rect.height, PIXEL_ARRAY_DIV);
471479
v4l2_ctrl_modify_dimensions(dev->pixel_array, dims);

0 commit comments

Comments
 (0)