[PATCH 3/4] media: zoran: reject VIDIOC_S_FMT while the queue is busy
From: Minseo Park
Date: Wed Nov 25 2026 - 02:06:21 EST
zoran_s_fmt_vid_cap() updates zr->v4l_settings, zr->jpg_settings,
zr->map_mode and zr->buffer_size without checking whether the queue
already owns buffers, so the format can be changed underneath an
allocated or streaming queue. The size the queue was set up with and
the geometry the hardware is programmed with then describe a format the
queue no longer matches.
Return -EBUSY while the queue is busy, as VIDIOC_S_FMT is specified to
do.
Signed-off-by: Minseo Park <hiyoukou@xxxxxxxxx>
---
drivers/media/pci/zoran/zoran_driver.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/media/pci/zoran/zoran_driver.c b/drivers/media/pci/zoran/zoran_driver.c
index 99fedac12b67..ec8ed5601f50 100644
--- a/drivers/media/pci/zoran/zoran_driver.c
+++ b/drivers/media/pci/zoran/zoran_driver.c
@@ -506,6 +506,9 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *fh,
int i;
int res = 0;
+ if (vb2_is_busy(&zr->vq))
+ return -EBUSY;
+
if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG)
return zoran_s_fmt_vid_out(file, fh, fmt);
--
2.43.0