]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: verisilicon: Explicitly disable selection api ioctls for decoders
authorPaul Kocialkowski <paulk@sys-base.io>
Thu, 28 Aug 2025 13:49:18 +0000 (15:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Nov 2025 20:37:13 +0000 (15:37 -0500)
[ Upstream commit 73d50aa92f28ee8414fbfde011974fce970b82cc ]

Call the dedicated v4l2_disable_ioctl helper instead of manually
checking whether the current context is an encoder for the selection
api ioctls.

Signed-off-by: Paul Kocialkowski <paulk@sys-base.io>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/verisilicon/hantro_drv.c
drivers/media/platform/verisilicon/hantro_v4l2.c

index fa972effd4a2cbdc0073d36fe6934bd812bcfa14..9d5e50fedae1fb6fac33c8ff94f76b5e3809e1dc 100644 (file)
@@ -917,6 +917,8 @@ static int hantro_add_func(struct hantro_dev *vpu, unsigned int funcid)
                vpu->decoder = func;
                v4l2_disable_ioctl(vfd, VIDIOC_TRY_ENCODER_CMD);
                v4l2_disable_ioctl(vfd, VIDIOC_ENCODER_CMD);
+               v4l2_disable_ioctl(vfd, VIDIOC_G_SELECTION);
+               v4l2_disable_ioctl(vfd, VIDIOC_S_SELECTION);
        }
 
        video_set_drvdata(vfd, vpu);
index 7c3515cf7d64a090adfb8d8aff368f9a617f8c8a..4598f9b4bd21c780607ec1d3e676789335a8c5dd 100644 (file)
@@ -663,8 +663,7 @@ static int vidioc_g_selection(struct file *file, void *priv,
        struct hantro_ctx *ctx = fh_to_ctx(priv);
 
        /* Crop only supported on source. */
-       if (!ctx->is_encoder ||
-           sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
+       if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
                return -EINVAL;
 
        switch (sel->target) {
@@ -696,8 +695,7 @@ static int vidioc_s_selection(struct file *file, void *priv,
        struct vb2_queue *vq;
 
        /* Crop only supported on source. */
-       if (!ctx->is_encoder ||
-           sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
+       if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
                return -EINVAL;
 
        /* Change not allowed if the queue is streaming. */