media: v4l2-core: correctly validate video and metadata ioctls
authorVandana BN <bnvandana@gmail.com>
Mon, 14 Oct 2019 08:40:19 +0000 (05:40 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 24 Oct 2019 14:40:56 +0000 (11:40 -0300)
commit96f49c1ac370c23ae55c63c67a0b40d83928bfbd
tree56ea5c7b530976133855aca305575dd0bfa30f1c
parent6ce1d376d33eb775331b36a38afa28f9f08945e3
media: v4l2-core: correctly validate video and metadata ioctls

If the type is VFL_TYPE_GRABBER, then also check device_caps
to see if the video device supports video and/or metadata and
disable unneeded ioctls.

Without this change, format ioctls for both video and metadata devices
could be called on both device nodes. This is true for other ioctls as
well, even if the device supports only video or metadata.

Metadata devices act similar to VBI devices w.r.t. which ioctls should
be enabled. This makes sense since VBI *is* metadata.

Signed-off-by: Vandana BN <bnvandana@gmail.com>
Co-developed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/v4l2-core/v4l2-dev.c
drivers/media/v4l2-core/v4l2-ioctl.c