Re: [PATCH v4 17/29] media: v4l2-subdev: Allow accessing routes with STREAMS client capability

Laurent Pinchart
2026-04-16T15:06:55Z

On Wed, Apr 08, 2026 at 06:39:26PM +0300, Sakari Ailus wrote:
> Disable access to routes when the STREAMS client capability bit isn't set.
> Routes aren't relevant otherwise anyway.
>
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com>
> Reviewed-by: Michael Riesch <michael.riesch@collabora.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

> ---
> drivers/media/v4l2-core/v4l2-subdev.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
> index f8fde395a53a..647587c0499a 100644
> --- a/drivers/media/v4l2-core/v4l2-subdev.c
> +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> @@ -1020,6 +1020,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
> if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS))
> return -ENOIOCTLCMD;
>
> + if (!client_supports_streams)
> + return -EINVAL;
> +
> memset(routing->reserved, 0, sizeof(routing->reserved));
>
> copy_routes_state_to_routing(routing, state);
> @@ -1041,6 +1044,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
> if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS))
> return -ENOIOCTLCMD;
>
> + if (!client_supports_streams)
> + return -EINVAL;
> +
> if (routing->which != V4L2_SUBDEV_FORMAT_TRY && ro_subdev)
> return -EPERM;
>

--
Regards,

Laurent Pinchart