]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: v4l2-subdev: Allow accessing routes with STREAMS client capability
authorSakari Ailus <sakari.ailus@linux.intel.com>
Thu, 5 Feb 2026 08:19:35 +0000 (10:19 +0200)
committerSakari Ailus <sakari.ailus@linux.intel.com>
Thu, 7 May 2026 10:23:50 +0000 (13:23 +0300)
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

index 2e927ec336e5dd41394a18c9848f044048a937d5..e9f81b9be9e24bac6ef51f2bf23842556aef25cb 100644 (file)
@@ -1019,6 +1019,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));
 
                v4l2_subdev_copy_routes(routing, state);
@@ -1040,6 +1043,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;