diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2019-07-23 11:21:25 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-07-25 13:28:51 +0300 |
commit | 3c1350501c21db8e3b1a38d9e97db29694305c3b (patch) | |
tree | 883ab470dc8d470ef7e4c71432b33baca748a46f /drivers/media/v4l2-core/v4l2-dev.c | |
parent | 08aac0e32fe44b0afe67da96b01c5c0aa27c7b67 (diff) | |
download | linux-3c1350501c21db8e3b1a38d9e97db29694305c3b.tar.xz |
media: v4l2-dev/ioctl: require non-zero device_caps, verify sane querycap results
Now that all V4L2 drivers set device_caps in struct video_device, we can add
a check for this to ensure all future drivers fill this in.
Also verify that when the querycap ioctl is called the driver didn't mess
with the device_caps value and that capabilities is a superset of device_caps.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
[hverkuil-cisco@xs4all.nl: fix too-long line]
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/v4l2-core/v4l2-dev.c')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-dev.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index cbb74f748555..3af72e3bbd65 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -859,6 +859,9 @@ int __video_register_device(struct video_device *vdev, /* the v4l2_dev pointer MUST be present */ if (WARN_ON(!vdev->v4l2_dev)) return -EINVAL; + /* the device_caps field MUST be set */ + if (WARN_ON(!vdev->device_caps)) + return -EINVAL; /* v4l2_fh support */ spin_lock_init(&vdev->fh_lock); |