aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2022-10-21 13:21:25 +0100
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-10-25 16:41:10 +0100
commiteb1d969203eb8212741751f88dcf5cb56bb11830 (patch)
treed446cd14a294e9c4a911cf50840f2234518331f4
parentmedia: videodev2.h: V4L2_DV_BT_BLANKING_HEIGHT should check 'interlaced' (diff)
downloadlinux-dev-eb1d969203eb8212741751f88dcf5cb56bb11830.tar.xz
linux-dev-eb1d969203eb8212741751f88dcf5cb56bb11830.zip
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 <hverkuil-cisco@xs4all.nl> Fixes: 6bc7643d1b9c (media: vivid: add pixel_array test control) Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
-rw-r--r--drivers/media/test-drivers/vivid/vivid-vid-cap.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/media/test-drivers/vivid/vivid-vid-cap.c b/drivers/media/test-drivers/vivid/vivid-vid-cap.c
index d52d24b61d34..11620eaf941e 100644
--- a/drivers/media/test-drivers/vivid/vivid-vid-cap.c
+++ b/drivers/media/test-drivers/vivid/vivid-vid-cap.c
@@ -466,6 +466,14 @@ void vivid_update_format_cap(struct vivid_dev *dev, bool keep_controls)
tpg_s_video_aspect(&dev->tpg, vivid_get_video_aspect(dev));
tpg_s_pixel_aspect(&dev->tpg, vivid_get_pixel_aspect(dev));
tpg_update_mv_step(&dev->tpg);
+
+ /*
+ * We can be called from within s_ctrl, in that case we can't
+ * modify controls. Luckily we don't need to in that case.
+ */
+ if (keep_controls)
+ return;
+
dims[0] = roundup(dev->src_rect.width, PIXEL_ARRAY_DIV);
dims[1] = roundup(dev->src_rect.height, PIXEL_ARRAY_DIV);
v4l2_ctrl_modify_dimensions(dev->pixel_array, dims);